input
stringlengths
10
828
output
stringlengths
5
107
public void run start the threadpool thread pool new thread pool thread pool set active true try do outstanding work until stopped while true try run outstanding wait outstanding catch interrupted exception we are done break finally stop the thread pool thread pool set active false thread pool null
run the scheduler
public long get next run return next run
gets the next run timestamp
public object get value try return new object name get as text catch malformed object name exception e throw new nested runtime exception e
returns a object name for the input object converted to a string
public void set maximum size int size max size size
set the maximum number of idle threads cached in this pool
public int get maximum size return max size
get the maximum number of idle threads cached in this pool
public void set active boolean status active status if active false while pool size 0 worker pool pop die
set the activity status of the pool
public void set daemon threads boolean value daemon value
set whether new threads are daemon threads
public boolean get daemon threads return daemon
get whether new threads are daemon threads
public void run while active running if work is available then execute it if work null try work run catch exception ignored clear work work null return to pool of cached idle threads return worker this wait for more work to become available synchronized this while running work null try this wait catch interrupted exception ignored
the worker loop
public void test unregister with default domain name throws exception try mbean server server mbean server factory new mbean server object name name new object name foo bar server register mbean new test name server unregister mbean name catch instance not found exception e fails in ri ri throws instance not found exception if you try to unregister with implicit default domain name fail fails in ri ri throws instance not found exception when an existing mbean is unregistered with an implicit default domain name
tests unregister with default domain name
public method lookup operation mbean operation info info if null info throw new illegal argument exception mbean operation info cannot be null return method map get operation signature info
return a method matching the signature defined in the operation info
public method lookup getter mbean attribute info info if null info throw new illegal argument exception mbean attribute info cannot be null return method map get getter signature info
return a method matching the getter signature expected for an attribute
public method lookup getter model mbean attribute info info if null info throw new illegal argument exception mbean attribute info cannot be null return method map get getter signature info
return a method matching the getter signature expected for a model mbean attribute
public method lookup setter mbean attribute info info if null info throw new illegal argument exception mbean attribute info cannot be null return method map get setter signature info
return a method matching the setter signature expected for an attribute
public method lookup setter model mbean attribute info info if null info throw new illegal argument exception model mbean attribute info cannot be null return method map get setter signature info
return a method matching the setter signature expected for a model mbean attribute
public method lookup method string return type string name string signature if null return type throw new illegal argument exception return type cannot be null if null name throw new illegal argument exception method name cannot be null return method map get method signature return type name signature
return a method matching the specified signature
protected hash map create map class resource class hash map cmap new hash map method methods resource class get methods for int i 0 i methods length i cmap put method signature methods i methods i return cmap
creates the signature string to method hash map
public url get resource string name class loader scl url resource null try this repository resource super get resource name scl next try our parent repository if resource null resource parent repository get resource name scl return resource
find a resource from this repository
public boolean get use parent first return java2 parent delegaton
get the use parent first flag
public void set use parent first boolean flag java2 parent delegaton flag
set the use parent first flag
public hash set get class loaders return class loaders
hash set ucl of classloaders in the repository
public void test unregister mbean on exception from pre deregister2 throws exception mbean server server mbean server factory new mbean server object name name new object name test foo bar server register mbean new locked test2 name try server unregister mbean name should not reach here fail locked test2 unregistered despite of throwin an exception from the pre deregister method catch mbean registration exception e expected assert true server is registered name assert true e get target exception instanceof my screaming exception
tests unregister for an mbean that prevents unregistration by throwing a
public url get resource string name class loader scl url resource null if java2 parent delegaton true try this repository resource parent repository get resource name scl next try our parent repository if resource null resource super get resource name scl else try this repository resource super get resource name scl next try our parent repository if resource null resource parent repository get resource name scl return resource
find a resource from this repository
public hash map get classes return classes
the loaded classes cache hash map string class
public void get resources string name class loader cl list urls if java2 parent delegaton true get the parent repository resources parent repository get resources name cl urls next get this repositories resources super get resources name cl urls else get this repositories resources super get resources name cl urls next get the parent repository resources parent repository get resources name cl urls
find all resource urls for the given name
public class load class from cache string name class found class null if java2 parent delegaton true try this repository found class parent repository load class from cache name next try our parent repository if found class null found class super load class from cache name else try this repository found class super load class from cache name we do not try the parent repository cache as this does not allow the child repository to override classes in the parent return found class
called by load mgr to locate a previously loaded class
public void test find associated mbeans errors throws exception relation service rs new relation service true boolean caught false try rs find associated mbeans null null null catch illegal argument exception e caught true if caught false fail find associated mbeans allows a null mbean name
test find associated mbeans errors
public unified class loader4 get class loader string name return new ucl wrapper this
called by load mgr to obtain all class loaders
public void test unregister mbean on exception from pre deregister3 throws exception mbean server server mbean server factory new mbean server object name name new object name test foo bar server register mbean new locked test3 name try server unregister mbean name should not reach here fail locked test3 unregistered despite of throwing an exception from the pre deregister method catch mbean registration exception e expected assert true server is registered name assert true e get target exception instanceof my screaming exception
tests unregister for an mbean that prevents unregistration by throwing a
public list get archives return archives
returns mbean archives
public list get versions return versions
returns mbean versions
public void set code string code this code trim code
sets the fully qualified class name of the mbean entry
public void set object string object this object trim object
sets the name of the serialized mbean instance
public void set codebase string url this codebase trim url
sets the code base for an mlet entry
public linked list get class loaders string class name string jar class name class loader utils get jar class name class name linked list ucls null synchronized class names map ucls linked list this class names map get jar class name return ucls
get the class loaders indexed to the given class name
public string to string string buffer tmp new string buffer super to string tmp set char at tmp length 1 tmp append added order tmp append added order tmp append
retruns a string representaion of this ucl
public url get resource string name url u repository get resource name this return u
load the resource from the repository using the load mgr as the
public boolean get use parent first return java2 parent delegation
get the use parent first flag
protected boolean attempt long wait ms boolean acquired false boolean trace log is trace enabled save and clear the interrupted state of the incoming thread boolean thread was interrupted thread current thread interrupted try acquired load lock attempt wait ms catch interrupted exception e finally restore the interrupted state of the thread if thread was interrupted thread current thread interrupt if trace log trace attempt load lock holds was acquired for this return acquired
attempt to acquire the class loading lock
public void set use parent first boolean flag java2 parent delegation flag
set the use parent first flag
protected void acquire save and clear the interrupted state of the incoming thread boolean thread was interrupted thread current thread interrupted try load lock acquire catch interrupted exception e finally restore the interrupted state of the thread if thread was interrupted thread current thread interrupt if log is trace enabled log trace acquired load lock holds for this
acquire the class loading lock
public class load class from cache string name class cls null synchronized classes cls class classes get name return cls
lookup a class from the repository cache
protected void release if log is trace enabled log trace release load lock holds for this load lock release if log is trace enabled log trace released holds load lock holds
release the class loading lock previous acquired through the acquire
public url get resource string name class loader scl url resource null if java2 parent delegation true try this repository resource parent repository get resource name scl next try our parent repository if resource null resource super get resource name scl else try this repository resource super get resource name scl next try our parent repository if resource null resource parent repository get resource name scl return resource
find a resource from this repository
public set parse mbean file string url throws parse exception malformed urlexception return parse mbean file new url url
reads an mlet text file from a given url
public object name get object name throws malformed object name exception string name jmx loading ucl integer to hex string super hash code return new object name name
obtain the object name under which the ucl can be registered with the
public void cache loaded class string name class cls class loader cl synchronized classes update the global cache classes put name cls update the cache for this classloader this is used to cycling classloaders hash set cl classes hash set loader to classes map get cl if cl classes null cl classes new hash set loader to classes map put cl cl classes cl classes add name
add a class to the repository cache
public void get resources string name class loader cl list urls if java2 parent delegation true get the parent repository resources parent repository get resources name cl urls next get this repositories resources super get resources name cl urls else get this repositories resources super get resources name cl urls next get the parent repository resources parent repository get resources name cl urls
find all resource urls for the given name
public string to string string buffer tmp new string buffer super to string tmp set char at tmp length 1 tmp append added order tmp append get added order tmp append
retruns a string representaion of this ucl
public class load class from cache string name class found class null if java2 parent delegation true try this repository found class parent repository load class from cache name next try our parent repository if found class null found class super load class from cache name else try this repository found class super load class from cache name we do not try the parent repository cache as this does not allow the child repository to override classes in the parent return found class
called by load mgr to locate a previously loaded class
public void test find referencing relations errors throws exception relation service rs new relation service true boolean caught false try rs find referencing relations null null null catch illegal argument exception e caught true if caught false fail find referencing relations allows a null mbean name
test find referencing relations errors
public void add url url url if url null throw new illegal argument exception url cannot be null if repository add class loader url this url true log debug added url url to ucl this super add url url else if log is trace enabled log trace ignoring duplicate url url for ucl this
append the given url to the urls used for class and resource loading
public url get resource locally string name url res url super get resource name if log is trace enabled true log trace get resource locally this name name res url res url return res url
provides the same functionality as
public url get url return delegate get url
get the url associated with the ucl
public url get orig url return delegate get orig url
get the original url associated with the ucl
public void get resources string name class loader cl list urls go through all class loaders hash set tmp class loaders synchronized class loaders tmp class loaders new hash set class loaders iterator iter tmp class loaders iterator while iter has next true class loader next cl class loader iter next if next cl instanceof unified class loader unified class loader ucl unified class loader next cl try enumeration res urls ucl find resources locally name while res urls has more elements object res res urls next element urls add res catch ioexception ignore
find all resource urls for the given name
public url get resource string name we delegate the repository the repository will decide the strategy to apply when looking for a resource url u null try unified loader repository2 acquire u repository get resource name delegate finally unified loader repository2 release return u
attempts to load the resource from its url and if not found
public url get orig url return orig url
get the original url associated with the ucl
private url get resource from cache string name class loader cl url resource null synchronized loader to resources map if loader to resources map contains key cl hash map resources hash map loader to resources map get cl resource url resources get name return resource
as opposed to classes resource are not looked up in a global cache
public url get resource string name url res repository get resource name this return res
attempts to load the resource from its url and if not found
private url get resource from global cache string name resource info ri null synchronized loader to resources map ri resource info global resources get name url resource null if ri null resource ri url return resource
check for a resource in the global cache
public enumeration find resources string name throws ioexception vector res urls new vector repository get resources name this res urls return res urls elements
find all resource urls for the given name
public enumeration find resources locally string name throws ioexception enumeration res urls super find resources name return res urls
provides the same functionality as
private url get resource from repository string name class loader cl go through all class loaders iterator i class loaders iterator url url null while i has next true class loader classloader class loader i next if classloader equals cl continue if classloader instanceof unified class loader url unified class loader classloader get resource locally name if url null cache loaded resource name url classloader cache global resource name url classloader break else do nothing go on with next classloader return url
do an exhaustive search of all class loaders for the resource
private void cache loaded resource string name url url class loader cl update the cache for this classloader only this is used for cycling classloaders synchronized loader to resources map hash map resources hash map loader to resources map get cl if resources null resources new hash map loader to resources map put cl resources resources put name url
update the loader to resources map
public string to string return super to string url get url
retruns a string representaion of this ucl
public void test find relations of type errors throws exception relation service rs new relation service true boolean caught false try rs find relations of type null catch illegal argument exception e caught true if caught false fail find relations of type allows a null relation type name caught false try rs find relations of type rubbish catch relation type not found exception e caught true if caught false fail find relations of type allows an invalid relation type name
test find relations of type errors
protected permission collection get permissions code source cs code source perm cs cs if orig url null perm cs new code source orig url cs get certificates permission collection perms super get permissions perm cs if log is trace enabled log trace get permissions url url orig url orig url perms return perms
override the permissions accessor to build a code source
private void add unified class loader unified class loader4 cl cl set repository this see if this url already exists url url cl get url boolean added false synchronized class loaders boolean exists class loader urls contains url if already present will not be added if exists class loader urls add url added class loaders add cl if added log debug adding cl added count cl set added order added count update class names map cl else log debug skipping duplicate cl
add a ucl to the repository
private void update class names map unified class loader cl try synchronized class names map string class names class loader utils update class names map cl class names map loader to class names map put cl class names catch exception e if log is trace enabled log trace failed to update classes for cl cl e else log debug failed to update classes for cl cl e
walk through the class loader url to see what packages it is capable
private void update class names map unified class loader cl url url try synchronized class names map string prev class names string loader to class names map get cl string class names class loader utils update class names map cl class names map url prev class names loader to class names map put cl class names catch exception e if log is trace enabled log trace failed to update classes for cl cl e else log debug failed to update classes for cl cl e
walk through the new url to update the packages the class loader is
private string get package name string class name int index class name last index of string pkg name class name if index 0 pkg name class name substring 0 index return pkg name
parse a class name into its package prefix
public void cache loaded class string name class cls class loader cl synchronized classes update the global cache object prev class classes put name cls if log is trace enabled log trace cache loaded class classname name class cls ucl cl update the cache for this classloader this is used to cycling classloaders hash set loaded classes hash set loader to classes map get cl if loaded classes null loaded classes new hash set loader to classes map put cl loaded classes loaded classes add name
add a class to the repository cache
public loader repository register class loader unified class loader ucl add class loader ucl notification msg new notification classloader added this get next sequence number msg set user data ucl broadcaster send notification msg return this
this method provides an mbean accessible way to add a
private void update package map unified class loader cl try string pkg names class loader utils update package map cl packages map loader to packages map put cl pkg names catch exception e if log is trace enabled log trace failed to update pkgs for cl cl e else log debug failed to update pkgs for cl cl e
walk through the class loader url to see what packages it is capable
public void set object factory pool object factory factory if objects null throw new illegal state exception initialized this factory factory
sets the object factory for the pool
public void test get referenced mbeans external throws exception mbean server server mbean server factory create mbean server try object name service create relation service test type service server create relation type c service create roles c server map result null relation support support new relation support id service server relation type c roles c add relation server service support test type support result support get referenced mbeans check mbeans result roles c finally mbean server factory release mbean server server
test get referenced mbeans
public void set object factory class java bean class if objects null throw new illegal state exception initialized factory new bean factory java bean class
sets the object factory as a new factory for java beans
public void add notification listener notification listener listener notification filter filter object handback throws illegal argument exception broadcaster add notification listener listener filter handback
add notification listener delegates to the broadcaster object we hold
public void set name string name if name null name length 0 throw new illegal argument exception cannot set pool name to null or empty if pool name null pool name equals name throw new illegal state exception cannot change pool name once set pool name name log logger get logger object pool class get name name
sets the name of the pool
public void remove notification listener notification listener listener throws listener not found exception broadcaster remove notification listener listener
remove notification listener delegates to our broadcaster object
public void set min size int size if objects null throw new illegal state exception initialized min size size if max size 0 min size max size max size min size log warn pool max size set to max size to stay min size
sets the minimum size of the pool
private void add unified class loader unified class loader3 cl cl set repository this see if this url already exists url url cl get url boolean added false synchronized class loaders boolean exists class loader urls contains url if already present will not be added if exists class loader urls add url added class loaders add cl if added log debug adding cl added count cl set added order added count update package map cl else log debug skipping duplicate cl
add a ucl to the repository
public void set max size int size if objects null throw new illegal state exception initialized max size size if max size 0 min size max size min size max size log warn pool min size set to min size to stay max size
sets the maximum size of the pool
private void update package map unified class loader cl try synchronized packages map string pkg names class loader utils update package map cl packages map loader to packages map put cl pkg names catch exception e if log is trace enabled log trace failed to update pkgs for cl cl e else log debug failed to update pkgs for cl cl e
walk through the class loader url to see what packages it is capable
public void set idle timeout enabled boolean enable timeout if objects null throw new illegal state exception initialized idle timeout enable timeout
sets whether the pool should release instances that have not been used
public object name get object name from arguments invocation invocation string method invocation get method get name if method equals invoke method equals set attribute method equals set attributes method equals add notification listener method equals remove notification listener return object name invocation get arguments 0 return null
return any target object name relevent for this invocation
private void update package map unified class loader cl url url try synchronized packages map string prev pkg names string loader to packages map get cl string pkg names class loader utils update package map cl packages map url prev pkg names loader to packages map put cl pkg names catch exception e if log is trace enabled log trace failed to update pkgs for cl cl e else log debug failed to update pkgs for cl cl e
walk through the new url to update the packages the class loader is
public void set jmsname string p name m jmsname p name
sets the jms queue factory name which allows the server to send
public void set ejbadaptor name string p name if p name null m ejbadaptor name ejb jmx ejb adaptor else m ejbadaptor name p name
sets the jndi name of the ejb adaptor
public map get method map return marshalled invocation mapping
expose the service interface mapping as a read only attribute
public iterator get connectors hashtable p properties connector factory impl iconnector tester p tester return m factory get connectors p properties p tester
look up for all registered jmx connector at a given jndi server
public remote mbean server create connection connector factory impl connector name p connector return m factory create connection p connector
initiate a connection to the given server with the given protocol
public void remove connection connector factory impl connector name p connector m factory remove connection p connector
removes the given connection and frees the resources
public void set gcenabled boolean enabled if objects null throw new illegal state exception initialized gcenabled enabled
sets whether garbage collection is enabled
public boolean equals object p test if p test instanceof jmsnotification listener try return m queue get queue name equals jmsnotification listener p test m queue get queue name catch jmsexception je log error equality test failed je return false
test if this and the given object are equal
public boolean equals object p test if p test instanceof rminotification listener return m client listener equals rminotification listener p test m client listener return false
test if this and the given object are equal
public void set max idle timeout percent float percent if objects null throw new illegal state exception initialized if percent 0f percent 1f throw new illegal argument exception percent must be between 0 and 1 max idle shrink percent percent
sets the idle timeout percent as a fraction between 0 and 1
public list get notifications return get notifications m maximum size
jmx managed operation
public list get notifications int p maxium size list l return null synchronized m list p maxium size p maxium size m list size m list size p maxium size l return new array list m list sub list 0 p maxium size m list remove all l return return l return
jmx managed operation