input
stringlengths
10
828
output
stringlengths
5
107
private container analysis lookup done class cls soft reference ref soft reference work done get cls if ref null return null container analysis ret container analysis ref get if ret null work done remove cls clear map entry if soft ref was cleared return ret
lookup an analysis in the fully done map
private container analysis create work in progress class cls container analysis analysis try analysis container analysis constructor new instance new object cls catch instantiation exception ex throw new runtime exception ex to string catch illegal access exception ex throw new runtime exception ex to string catch invocation target exception ex throw new runtime exception ex to string work in progress put cls new in progress analysis thread current thread return analysis
create new work in progress
public method get accessor return accessor
return my accessor method
public method get mutator return mutator
return my mutator method
public operation analysis get accessor analysis return accessor analysis
return my accessor operation analysis
public operation analysis get mutator analysis return mutator analysis
return my mutator operation analysis
public boolean is notification enabled notification p notification if p notification instanceof timer notification timer notification l timer notification timer notification p notification if log is trace enabled log trace scheduler notification filter is notification enabled id m id notification p notification notification id l timer notification get notification id timestamp l timer notification get time stamp message l timer notification get message return l timer notification get notification id equals m id return false
determine if the notification should be sent to this scheduler
public object invoke invocation mi throws throwable method m mi get method string method name m get name http invoker proxy ha proxy http invoker proxy ha mi get invocation context get invoker implement local methods if method name equals to string return to string proxy if method name equals equals object args mi get arguments string this string to string proxy string args string args 0 null args 0 to string return new boolean this string equals args string if method name equals hash code return integer mi get object name return get next invoke mi
handle methods locally on the client
public boolean is local invocation invocation return colocation contains invocation get object name
returns wether we are local to the originating container or not
public class get load balance policy return this policy class
get the server side mbean that exposes the invoke operation for the
public void set load balance policy class policy class this policy class policy class
set the server side mbean that exposes the invoke operation for the
public string get partition name return this partition name
get the name of the cluster partition the invoker is deployed in
public void set partition name string name this partition name name
set the name of the cluster partition the invoker is deployed in
public void set invoker name object name jmx invoker name real jmx invoker name jmx invoker name object name factory name get service name hashtable props factory name get key property list props put wrapper type http ha try wrapped jmx invoker name new object name factory name get domain props super set invoker name wrapped jmx invoker name catch malformed object name exception e throw new illegal state exception was not able to create wrapped object name
override the superclass method to create a wrapped object name for the
protected void stop service throws exception try mbean server mbean server super get server mbean server unregister mbean wrapped jmx invoker name catch exception e log debug failed to unregister hainvoker wrapper wrapped jmx invoker name e super stop service
override the http proxy factory stop to unregister the hainvoker wrapper
public void destroy super destroy try invoker target destroy catch exception ignore
destroys the hatarget
public long get next group id return group id
return the next distinct id for a new group
public interface hapartition state transfer called when a new node need to be initialized this is called on any existing node to determine a current state for this service return a serializable representation of the state public serializable get current state this callback method is called when a new service starts on a new node the state that it should hold is transfered to it through this callback param new state the serialized representation of the state of the new service public void set current state serializable new state
state management is higly important for clustered services
public int compare to object o int my size member node names size int its size sub partition info o member node names size if my size its size return 0 else if my size its size return 1 else return 1
note this class has a natural ordering that is
public interface asynch hamembership listener extends hamembership listener nothing new
a tagging interface for hamembership listener callbacks that will
public interface asynch hamembership extended listener extends hamembership extended listener nothing new
a tagging interface for hamembership extended listener callbacks that will
public void create throws exception lookup the parition initial context ctx new initial context string jndi name hapartition partition name hapartition partition hapartition ctx lookup jndi name this entry map partition get distributed state service log debug obtained distributed state from partition partition name now system current time millis
initializes the cache for use
public void start resolution timer schedule at fixed rate this 0 1000 resolution
schedules this with the class resolution timer timer object for
public void stop super cancel
stop cancels the resolution timer and flush es the cache
public void set scanner name string name log warn scanner name does nothing
backward compatibility but ignored as it does nothing
public object get object key serializable skey serializable key timed entry entry timed entry entry map get category skey if entry null return null if entry is current now false try to refresh the entry if entry refresh false failed remove the entry and return null entry destroy try entry map remove category skey catch exception e log debug failed to remove expired entry e return null object value entry get value return value
get the cache value for key if it has not expired
public object peek object key serializable skey serializable key timed entry entry timed entry entry map get category skey object value null if entry null value entry get value return value
get the cache value for key
public void set lookup names string names this lookup names names
set the names of jndi bindings that should be queried on each host
public string get provider urlpattern return url pattern
get the context
public void set provider urlpattern string regex this url pattern regex this url prefix regex this url suffix string host exp host int host index regex index of host exp if host index 0 url prefix regex substring 0 host index int end index host index host exp length url suffix regex substring end index
set the regular expression containing the hostname ip address of
public void insert object key object value serializable skey serializable key timed entry entry timed entry entry map get category skey if entry null throw new illegal state exception attempt to insert duplicate entry if value instanceof timed entry false wrap the value in a default timed entry serializable svalue serializable value entry new default timed entry default lifetime svalue else entry timed entry value entry init now try entry map set category skey entry catch exception e log error failed to set entry e
insert a value into the cache
public vector get current view return partition get current view
return the list of member nodes that built from the current view
protected void create service throws exception super create service server config l config server config locator locate m temp directory l config get server temp dir create unexisting local dir
looks up the server config instance to figure out the
public void remove object key serializable skey serializable key try timed entry entry timed entry entry map remove category skey if entry null entry destroy catch exception e log error failed to remove entry e
remove the entry associated with key and call destroy on the entry
private address port get member address object addr address port info null try class parameter types object args method get ip address addr get class get method get ip address parameter types inet address inet addr inet address get ip address invoke addr args method get port addr get class get method get port parameter types integer port integer get port invoke addr args info new address port inet addr port catch exception e log warn failed to obtain inet address port from addr addr e return info
use reflection to access the address inet address and port if they exist
public void flush collection keys entry map get all keys category notify the entries of their removal iterator iter keys iterator while iter has next serializable key serializable iter next timed entry entry timed entry entry map get category key entry destroy
remove all entries from the cache
public int get default lifetime return default lifetime
get the default lifetime of cache entries
public void run now system current time millis
the timer task run method
public interface hasession state listener public void session externally modified packaged session session
information that can be used to clean a cache for example
public long current time millis return now
get the cache time
public timed entry peek entry object key serializable skey serializable key timed entry entry timed entry entry map get category skey return entry
get the raw timed entry for key without performing any expiration check
public server il get ha server ilproxy return ha server ilproxy
gets the ha server ilproxy
public void set ha server ilproxy server il ha server ilproxy this ha server ilproxy ha server ilproxy
sets the ha server ilproxy
public server il clone server il return ha server ilproxy
no need to clone because there are no instance variables tha can get
public string get name return elba mq haserver il
gives this jmx service a name
public server il get server il return server ilproxy
used to construct the generic connection factory bind jndireferences
public void stop service try unbind jndireferences harmi destroy super stop service catch exception ex log error error stopping haserver il ex throw new runtime exception error stopping haserver il
stops this il and unbinds it from jndi
public string get partition name return partition name
gets the partition name
public void set partition name string partition name this partition name partition name
sets the partition name
public void invalidate locally object id if id null return try get cache remove id catch exception e log debug e
remove an object from the local cache without any locking
public string get load balance policy return load balance policy
gets the load balance policy
public void set load balance policy string load balance policy this load balance policy load balance policy
sets the load balance policy
public void call asynch method on cluster string obj name string method name object args boolean exclude self throws exception method call m new method call obj name method name args if exclude self this call remote methods this other members m group request get none timeout else this call remote methods null m group request get none timeout
this function is an abstraction of rpc dispatcher for asynchronous messages
private void init string to addresses string from address string mail host m to addresses to addresses m from address from address m properties new properties m properties set property mailhost mail host
initialise the email watchdog listener
public string get event return m event
gets a description of the event
final synchronized public boolean start mbean log debug start mbean boolean started false try final int mbean provisional state get mbean provisional state if mbean provisional state stopped mbean provisional state failed to start set mbean provisional state starting try started start mbean impl catch exception e log warning start mbean exception thrown log warning e started false catch throwable t log warning start mbean throwable thrown log warning t started false set mbean provisional state started running failed to start return started finally log debug start mbean done started
starts the mbean delegates implementation to the code start mbean impl code method
final synchronized public boolean stop mbean log debug stop mbean boolean stopped false try final int mbean provisional state get mbean provisional state if mbean provisional state running mbean provisional state failed to stop set mbean provisional state stopping try stopped stop mbean impl catch exception e log warning stop mbean exception thrown log warning e stopped false catch throwable t log warning start mbean throwable thrown log warning t stopped false set mbean provisional state stopped stopped failed to stop return stopped finally log debug stop mbean done stopped
stops the mbean delegates implementation to the code stop mbean impl code method
public int get current corrective action return m current corrective action
gets the current corrective action
final synchronized public boolean restart mbean log debug restart mbean boolean restarted false try final int mbean state retrieve mbean state final int mbean state get mbean state if mbean state running restarted true else if mbean state failed set mbean provisional state restarting try restarted restart mbean impl catch exception e log warning restart mbean exception thrown log warning e restarted false catch throwable t log warning start mbean throwable thrown log warning t restarted false set mbean provisional state running return restarted finally log debug restart mbean done restarted
restart an mbean delegates implementation to code restart mbean impl code
public int get worst corrective action return m worst corrective action
gets the worst current corrective action so far
public void set corrective action succeeded final boolean succeeded throws hermes exception if succeeded update corrective action get initial corrective action else if has count reached max increase corrective action severity
set whether the current corrective action succeeded
public void add string key string node name serializable replicant if log is debug enabled log debug add key node name try add replicant key node name replicant notify key listeners key lookup replicants key catch exception ex log error add failed ex
cluster callback called when a new replicant is added on another node
final public string get mbean state string return get state as string retrieve mbean state
gets the state of the mbean as a string
private void update corrective action final int corrective action throws hermes exception if get current corrective action corrective action set count 0 set current corrective action corrective action update worst corrective action set count get count 1
update the current corrective action also updates the worst current corrective action
final synchronized public void simulate failure set mbean provisional state failed
simulates failure in the mbean
public void remove string key string node name try if remove replicant key node name notify key listeners key lookup replicants key catch exception ex log error remove failed ex
cluster callback called when a replicant is removed by another node
final private void set mbean provisional state int provisional state final string provisional state as string get state as string provisional state log debug set mbean provisional state provisional state as string m provisional state provisional state set mbean state string provisional state as string
sets the provisional state of the mbean
final private int get mbean provisional state return m provisional state
gets the provisional state of the mbean
private int get num times to attempt corrective action final int corrective action switch corrective action case invoke restart method return get watchdog interface get num times to attempt mbean restart case reregister mbean return get watchdog interface get num times to attempt mbean reregister case restart agent return get watchdog interface get num times to attempt agent restart default restart machine return get watchdog interface get num times to attempt machine restart
gets the number of times a corrective action can be attempted
public object invoke invocation invocation throws exception set the method hash to method mapping if invocation instanceof marshalled invocation marshalled invocation mi marshalled invocation invocation mi set method map marshalled invocation mapping invoke the naming method via reflection method method invocation get method object args invocation get arguments object value null try value method invoke the server args catch invocation target exception e throwable t e get target exception if t instanceof exception throw exception t else throw new undeclared throwable exception t method to string return value
expose the naming service via jmx to invokers
private int get initial corrective action return m initial corrective action
gets the initial corrective action
public boolean add listener watchdog listener watchdog listener boolean added false if m listeners null m listeners new array list if m listeners contains watchdog listener m listeners add watchdog listener added true return added
adds a listener to watchdog events
protected boolean start mbean impl log debug start mbean impl sleep get call delay if get call success set is running true log debug start mbean impl done return get call success
starts test1 will succeed if code get call success code is true
private void validate corrective action final int corrective action throws hermes exception if corrective action invoke restart method corrective action restart machine throw new hermes exception invalid corrective action null
validates a corrective action
public boolean add listener string class name string constructor params boolean added false try object listener class for name class name get constructor new class string class new instance new object constructor params if m listeners null m listeners new array list m listeners add listener added true catch exception e e print stack trace added false return added
adds a listener to watchdog events
protected boolean stop mbean impl sleep get call delay if get call success set is running false return get call success
stops test1 will succeed if code get call success code is true
public boolean remove listener watchdog listener watchdog listener boolean removed false if m listeners null m listeners contains watchdog listener m listeners remove watchdog listener removed true return removed
removes a listener
protected boolean has mbean failed return is mbean running
returns whether test1 isnt running
public boolean remove listener int index boolean removed false if m listeners null m listeners size index m listeners remove index removed true return removed
removes a listener
protected boolean is mbean running return m is running
returns whether test1 is running
public list get listeners return m listeners
get a list of the listeners
private void set count int count m count count
sets the number of times that the current corrective action has been applied
public void set call success boolean call success m call success call success
sets whether calls to startable mbean methods will succeed
public void dispatch event watchdog event watchdog event if m listeners null for iterator i m listeners iterator i has next watchdog listener watchdog listener watchdog listener i next watchdog listener receive event watchdog event
dispatches a watchdog event to all the listeners
public boolean get call success return m call success
gets whether calls to startable mbean methods will succeed
protected void add replicant string key string node name serializable replicant add replicant replicants key node name replicant
add a replicant to the replicants map
public void set call delay long call delay m call delay call delay
sets how long calls to to startable mbean methods will take
public long get call delay return m call delay
gets how long calls to to startable mbean methods will take
private int get count return m count
gets the number of times that the current corrective action has been applied
private void set is running boolean is running log debug set is running is running m is running is running
sets the running state of test1
private void sleep long milliseconds if milliseconds 0 try thread current thread sleep milliseconds catch exception e
sleep for a while
protected void add replicant hash map map string key string node name serializable replicant synchronized map hash map rep hash map map get key if rep null log debug adding new hash map rep new hash map map put key rep rep put node name replicant
logic for adding replicant to any map
public string to string return corrective action context exception class get name m reason
returns a string representation of this corrective action context exception
protected boolean apply impl throws exception agent remote interface agent remote interface agent remote interface get corrective action context get context object corrective action context constants agent remote interface if agent remote interface is running agent remote interface stop agent agent remote interface start agent return agent remote interface is running
apply the restart agent corrective action
public boolean is overriden by final corrective action corrective action return corrective action instanceof invoke method corrective action
returns whether code corrective action code overrides this
protected boolean replicant entry already exists string key string node name return replicant entry already exists replicants key node name
indicates if the a replicant already exists for a given key node pair
public string to string return corrective action exception class get name m reason
returns a string representation of this corrective action context exception
public boolean add corrective action corrective action corrective action boolean result m corrective action sequence add corrective action if m corrective action context null result corrective action set corrective action context m corrective action context return result
adds a corrective action
protected boolean apply impl throws exception final long start time system current time millis process process runtime get runtime exec m script name integer exit value null while exit value null try exit value new integer process exit value catch illegal thread state exception itse exit value null if system current time millis start time m timeout try thread current thread sleep m delay time catch exception e exit value null else break return exit value null exit value int value 0
apply this corrective action i
public boolean apply current corrective action throws corrective action exception exception corrective action current corrective action get current corrective action if current corrective action null throw new corrective action exception no current corrective action return current corrective action apply
obtains the current corrective action to apply and applies it