input
stringlengths
10
828
output
stringlengths
5
107
private object name get watched domain object name return m watched domain object name
gets the domain being watched
public string get sql properties try byte array output stream boa new byte array output stream sql properties store boa return new string boa to byte array catch ioexception shouldnothappen return
gets the sql properties
public void remove logged on client id string id synchronized logged on client ids logged on client ids remove id
description of the method
public void set sql properties string value try byte array input stream is new byte array input stream value get bytes sql properties new properties sql properties load is catch ioexception shouldnothappen
sets the sql properties
public void start service throws exception load config
description of the method
private void set rmi agent binding string rmi agent binding m rmi agent binding rmi agent binding
sets the rmi binding of the agent being watched
protected void check logged on client id string client id throws jmsexception synchronized state config enumeration enum state config get elements named users user while enum has more elements xelement element xelement enum next element try if element contains field id element get field id equals client id throw new invalid client idexception this logged on client ids is password protected catch xelement exception ignore
check if the client id belonges to a preconfigured user
private void set watched domain object name object name object name m watched domain object name object name
sets the domain being watched
public spy topic get durable topic durable subscription id sub throws jmsexception durable subscription subscription get durable subscription sub if subscription null throw new jmsexception no durable subscription found for subscription sub get subscription name return new spy topic subscription get topic
get spy topic for the give durable subscription id
public string check user string login string passwd throws jmsexception string client id get preconf client id login passwd if client id null synchronized logged on client ids if logged on client ids contains client id throw new jmssecurity exception the login id has an assigned client id that client id is already connected to the server logged on client ids add client id return client id
get a preconfiged client id and possible do authentication
public void add logged on client id string id throws jmsexception check this id must not be registered synchronized logged on client ids if logged on client ids contains id throw new invalid client idexception this logged on client ids is already registered check logged on client id id synchronized logged on client ids logged on client ids add id
this manager keeps the state of the logged in client id
public void commit throws jmsexception if add log info log finish add message tx id else log info log finish remove message tx id
description of the method
private void set agent remote interface agent remote interface agent remote interface m agent remote interface agent remote interface
sets the remote interface of the jmx agent being watched
public void rollback throws jmsexception if add log info log undo add message tx id else log info log undo remove message tx id
description of the method
public void add element record string name target records add element name
adds a name to the list of element names which when encountered will
public void clear element records target records remove all elements
clears all the previously added element record names
public void asynch close
description of the method
private connection get connection throws sqlexception int attempts this connection retry attempts int attempt count 0 sqlexception sql exception null while attempts 0 if attempt count 1 log debug retrying connection attempt attempt count try sql exception null return datasource get connection catch sqlexception exception log debug connection attempt attempt count failed with sqlexception exception sql exception exception finally if sql exception null attempt count 1 log debug connection succeeded on attempt attempt count if attempts 0 try thread sleep 1500 catch interrupted exception interrupted exception break if sql exception null throw sql exception throw new sqlexception connection attempt interrupted
gets a connection from the datasource retrying as needed
public void set attribute string key string value metadata put key value
sets adds a metatag value only metatags whose value is not empty will
public void set client id java lang string new client id client id new client id
insert the methods description here
public void set subscription name java lang string new subscription name subscription name new subscription name
insert the methods description here
public void asynch delete temporary destination spy destination dest try delete temporary destination dest catch jmsexception e asynch failure e get message e get linked exception
description of the method
private agent remote interface get agent remote interface return m agent remote interface
gets the remote interface of the jmx agent being watched
public void on message message message if message instanceof text message text message msg text message message try system out println subscriber reading message msg get text catch jmsexception e system out println exception in on message e to string else monitor all done
casts the message to a text message and displays its text
public void run threads synch subscriber synch subscriber new synch subscriber simple publisher simple publisher new simple publisher synch subscriber start simple publisher start try synch subscriber join simple publisher join catch interrupted exception e
instantiates the subscriber and publisher classes and starts their
public void start subscriber try system out println starting subscriber topic connection stop topic subscriber topic session create durable subscriber topic make it last topic listener new text listener topic subscriber set message listener topic listener topic connection start catch jmsexception e system out println exception occurred e to string exit result 1
stops connection then creates durable subscriber registers message
public void asynch deliver receive request requests if we are closing the connection the server will nack the messages if closing return try for int i 0 i requests length i spy consumer consumer spy consumer subscriptions get requests i subscription id requests i message create acknowledgement request requests i subscription id int value if consumer null send requests i message get acknowledgement request false log debug warning nack issued due to non existent subscription continue consumer add message requests i message catch jmsexception e asynch failure e get message e get linked exception
description of the method
public void close subscriber try topic listener monitor wait till done system out println closing subscriber topic subscriber close catch jmsexception e system out println exception occurred e to string exit result 1
blocks until publisher issues a control message indicating
public void finish if topic connection null try topic session unsubscribe make it last topic connection close catch jmsexception e exit result 1
closes the connection
public void publish messages text message message null int i final int nummsgs 3 final string msg text new string here is a message try message topic session create text message for i startindex i startindex nummsgs i message set text msg text i 1 system out println publisher publishing message message get text topic publisher publish message send a non text control message indicating end of messages topic publisher publish topic session create message startindex i catch jmsexception e system out println exception occurred e to string exit result 1
creates text message
public string get attribute string key string t string metadata get key if t null return return t
returns the value of a meta data value
public void finish if topic connection null try topic connection close catch jmsexception e exit result 1
closes the connection
public void asynch failure string reason exception e exceptions due to closing will be ignored if closing return jmsexception excep if e instanceof jmsexception excep jmsexception e else excep new spy jmsexception reason e excep fill in stack trace if exception listener null synchronized exception listener if exception listener null exception listener on exception excep else log warn connection failure excep else log warn connection failure excep
description of the method
public string choose type int which msg random rgen new random which msg rgen next int arrsize return message types which msg
chooses a message type by using the random number generator
public void on message message message if message instanceof text message text message msg text message message try system out println reading message msg get text catch jmsexception e system out println exception in on message e to string else monitor all done
casts the message to a text message and displays its text
public xelement get parent return parent
get the parent of this object or the object the contains this one
public void run threads request request new request reply reply new reply request start reply start try request join reply join catch interrupted exception e
instantiates the request and reply classes and starts their
public object name get message cache return message cache name
describe code get message cache code method here
public void on message message in message text message msg text message in message string news type try system out println subscriber subscriber number thread message received msg get text news type msg get string property news type if news type equals topic selectors end of message stream type system out println subscriber subscriber number thread received finished publishing message monitor all done catch jmsexception e system out println exception in on message e to string
displays the message text
public string get text return contents element at 0 to string trim
gets the trimmed character data that was within this object
public void asynch pong long server time if log is trace enabled log trace pong server il server il ponged true
description of the method
public boolean validate password string user string input password throws exception boolean valid false xelement u find user user if u null string pw u get field password if input password null input password equals pw valid true return valid
validate the user password combination
public void on message message message if message instanceof text message text message msg text message message try system out println subscriber processing message msg get text catch jmsexception e system out println exception in on message e to string else monitor all done
casts the message to a text message and displays its text
public void on message message message if message instanceof text message text message msg text message message try system out println subscriber thread reading message msg get text catch jmsexception e system out println exception in on message e to string else monitor all done
casts the message to a text message and displays its text
public void run threads final int num subscribers 3 subscriber subscriber array new subscriber num subscribers publisher publisher new publisher num subscribers subscriber array 0 new subscriber message types 2 0 subscriber array 0 start subscriber array 1 new subscriber message types 3 1 subscriber array 1 start subscriber array 2 new subscriber message types 4 2 subscriber array 2 start publisher start for int i 0 i subscriber array length i try subscriber array i join catch interrupted exception e try publisher join catch interrupted exception e
creates an array of subscriber objects one for each of three message
public void set message cache object name message cache this message cache name message cache
describe code set message cache code method here
public void run threads asynch subscriber asynch subscriber new asynch subscriber multiple publisher multiple publisher new multiple publisher multiple publisher start asynch subscriber start try asynch subscriber join multiple publisher join catch interrupted exception e
instantiates the subscriber and publisher classes and starts their
public attribute list get attributes string attribute names attribute list atts new attribute list for int i 0 i attribute names length i try object value get attribute attribute names i atts add new attribute attribute names i value catch exception e return atts
describe code get attributes code method here
public void run threads synch sender synch sender new synch sender synch receiver synch receiver new synch receiver asynch subscriber asynch subscriber new asynch subscriber multiple publisher multiple publisher new multiple publisher synch sender start synch receiver start try synch sender join synch receiver join catch interrupted exception e asynch subscriber start multiple publisher start try asynch subscriber join multiple publisher join catch interrupted exception e
instantiates the sender receiver subscriber and publisher classes and
public void run threads header subscriber header subscriber new header subscriber header publisher header publisher new header publisher header subscriber start header publisher start try header subscriber join header publisher join catch interrupted exception e
instantiates the subscriber and publisher classes and starts their
public boolean is cancelled return status cancelled status
determines if order status is cancelled
public boolean login throws login exception if mcf null return false end of if return super login
describe code login code method here
public boolean is field return contents size 1
returns true if the object is an attribute object
public throwable get nested return get linked exception
return the nested tt throwable tt
public throwable get cause return get linked exception
return the nested tt throwable tt
protected void remove credentials shared state remove javax security auth login name shared state remove javax security auth login password set credentials subject get private credentials for iterator i credentials iterator i has next object o i next if o instanceof password credential password credential o get managed connection factory mcf i remove end of if end of for
the remove credentials method removes whatever is necessary to
public string get message return nested throwable util get message super get message get linked exception
returns the composite throwable message
public void print stack trace final print stream stream exception linked get linked exception if linked null nested throwable parent trace enabled super print stack trace stream nested throwable util print linked stream
prints the composite message and the embedded stack trace to the
public void print stack trace final print writer writer exception linked get linked exception if linked null nested throwable parent trace enabled super print stack trace writer nested throwable util print linked writer
prints the composite message and the embedded stack trace to the
public void add string data string buffer contents element at 0 append data
adds and appends string data to the objects text
public void set provider jndi final string provider jndi this provider jndi provider jndi
set provider jndi the jms provider adapter to use
public string get provider jndi return provider jndi
get provider jndi
public boolean is topic return is topic
type of the jms session defaults to true
public void set is topic boolean is topic this is topic is topic
set the default session type
public string to string return to string 0 true
serializes this object into a string
public void set session default type string type throws resource exception if type equals queue type is topic false else if type equals topic type is topic true else throw new resource exception type is not a recogniced jms session type
helper method to set the default session type
public boolean equals object obj if obj null return false if obj instanceof jms mcfproperties jms mcfproperties you jms mcfproperties obj return strings compare user name you get user name strings compare password you get password strings compare provider jndi you get provider jndi this is topic you is topic return false
test for equality of all attributes
public int hash code fixme string result user name password provider jndi is topic return result hash code
simple hash code of all attributes
private session get session throws jmsexception ensure that the connection is opened if mc null throw new illegal state exception the session is closed return mc get session
ensure that the session is opened
public void add element xelement sub object contents add element sub object sub object parent this
adds an xelement to the set of xelements that are contained by this
public object create connection factory throws resource exception return create connection factory null
create a non managed connection factory
public void set defaults jms mcfproperties prop if user name null user name prop get user name may be null there to if password null password prop get password may be null there to
fill in default values if missing
private void destroy handles throws resource exception iterator iter handles iterator while iter has next jms session iter next destroy clear the handles map handles clear
destroy all handles
public void add field string key string value xelement sub object new xelement key sub object add value add element sub object
adds an xelement to the set of xelements that are contained by this
public int check inventory random rgen new random return rgen next int quantity 5
checks to see if there are enough items in inventory
private boolean is equal object o1 object o2 if o1 null return o2 null else return o1 equals o2
may be used if we fill in username and password later
public boolean equals object obj if obj null return false if obj instanceof jms managed connection factory return mcf properties equals jms managed connection factory obj get properties else return false
checks for equality ower the configured properties
public void destroy throws resource exception if is destroyed return is destroyed true destory handles destroy handles try close session and connection if info is topic topic session close if xa transacted xa topic session close else queue session close if xa transacted xa queue session close con close catch jmsexception e throw new elba resource exception could not properly close the session and connection e
destroy the physical connection
public message listener get message listener throws jmsexception throw new illegal state exception method not allowed
always throws an exception
public boolean contains element string object name try get element object name return true catch xelement exception e return false
tests to see if this object contains the specified object
public void run should this really throw an error throw new error method not allowed
always throws an error
public void cleanup throws resource exception if is destroyed throw new illegal state exception managed connection already destroyd destory handles destroy handles
cleans up the from the spec
public string get xadata source class return xa data source class
get the xa data source class value
public void set user name string user name mcf properties set user name user name
set user name null by default
public void close throws jmsexception if mc null log debug closing session special stuff fixme mc remove handle this connection event ev new connection event mc connection event connection closed ev set connection handle this mc send event ev mc null
closes the session
public void set xadata source class string xa data source class this xa data source class xa data source class
set the xa data source class value
public string get user name return mcf properties get user name
get user name may be null
public string get xadata source properties return xa data source properties
get the xadata source properties value
public void set xadata source properties string xa data source properties throws resource exception this xa data source properties xa data source properties xa props clear if xa data source properties null input stream is new byte array input stream xa data source properties get bytes try xa props load is catch ioexception ioe throw new elba resource exception could not load connection properties ioe
set the xadata source properties value
public void set password string password mcf properties set password password
set password null by default
public boolean contains field string object name try xelement obj get element object name return obj is field catch xelement exception e return false
tests to see if this object contains the specified attribute object
public boolean get is same rmoverride value return is same rmoverride value
get the is same rmoverride value value
public string get password return mcf properties get password
get password may be null
public boolean is same rm xaresource ignored throws xaexception return false
p this is a workaround for a problem with oracle xa resource manager
public void set is same rmoverride value boolean is same rmoverride value this is same rmoverride value is same rmoverride value
set the is same rmoverride value value
public void set session default type string type throws resource exception mcf properties set session default type type
set the default session typ
public void set jms provider adapter final jmsprovider adapter adapter this adapter adapter
for local access
public void add connection event listener final connection event listener l listeners add element l if log is debug enabled log debug connection event listener added l
add a connection event listener
protected void broadcast connection error sqlexception e super broadcast connection error e
describe code broadcast connection error code method here
public void set connection retry attempts int value this connection retry attempts value
sets the connection retry attempts