input
stringlengths
10
828
output
stringlengths
5
107
private void generate node locators element parent collection factory definition node locator node locator definitions for factory definition node locator factory def node locator definitions if factory def get inheritance inheritance inherited generate node locator parent factory def
generates node locator elements for the given collection of node locator definition factories
private void generate node roles element parent map string node role definition node role definitions for node role definition node role def node role definitions values if node role def get inheritance inheritance inherited generate node role parent node role def
generates the node role elements
public server roles view get roles view return roles ref get
returns the server roles view which also includes the view id
private element generate node role element parent node role definition node role def element node role element create element parent node role element node role element set attribute name attribute node role def get id generate def node role element node role def return node role element
generates a node role element
public server roles view set roles set string roles for server roles view previous roles view roles ref get set string new roles new hash set string roles new roles add node role definition any role if roles equal previous roles view new roles if log is debug enabled log debug set roles the server roles are already set to new roles no action necessary return null server roles view new roles view inner compare and set roles previous roles view new roles if new roles view null return new roles view
sets the roles of the server
private element generate node locator element parent factory definition node locator factory def element node locator element create element parent node locator element node locator element set attribute name attribute factory def get id generate def node locator element factory def create text element node locator element class name element factory def get factory class generate attributes node locator element factory def get attributes return node locator element
generates a node locator element for the given node locator definition factory
private element generate default target element parent string default target id return create text element parent default target element default target id
generates a default target element
public cluster config info get active config info string cluster throws cluster config exception try return cache get cluster catch exception ex if ex instanceof cluster config exception throw cluster config exception ex throw new cluster config exception an error occurred while attempting to retrieve active cluster config id for cluster cluster from cache ex
retrieves the cluster config info object for the given cluster
public void invalidate cluster string cluster if invalidation manager null local invalidation log warn invalidate cluster cluster invalidating local cache only local invalidate cluster cluster else publish an invalidation request log info invalidate cluster cluster publishing invalidation message to invalidate distributed cache this invalidation manager batch invalidate create invalidate cluster message cluster true
invalidate the cached entry for the given cluster
public void invalidate cluster config string config id if invalidation manager null local invalidation log warn invalidate cluster config config id invalidating local cache only local invalidate cluster config config id else publish an invalidation request log info invalidate cluster config config id publishing invalidation message to invalidate distributed cache this invalidation manager batch invalidate create invalidate config message config id true
invalidate all cached entries that reference the given configuration id
private void publish state server state view state view for string group name get invalidation group names publish state group name state view
publishes the state of this server to all listeners in all groups
public string get config id return config id
the id of the configuration for the cluster
private void publish roles server roles view roles view for string group name get invalidation group names publish roles group name roles view
publishes the roles of this server to all listeners in all groups
private void generate values element parent collection string values for string value values create text element parent value element value
generates value elements for the given collection of strings
public object get object attribute string name iterator extends object it get attributes name iterator return it has next it next null
returns the first value for the given attribute
public string get attribute string name return string get object attribute name
returns the first string value for the given attribute name
public long get long attribute string attribute name long default value long value string str call duration weight get attribute attribute name if str call duration weight null try value new long str call duration weight long value catch number format exception ex log warn initialize id invalid numeric value str call duration weight specified for attribute attribute name using default value of default value value default value else if log is info enabled log info initialize id value for attribute attribute name not specified using default value of default value value default value return value
returns the attribute value as a long
public int get int attribute string attribute name int default value return int get long attribute attribute name default value
returns the attribute value as an integer
public cluster configuration get cluster config string cluster throws cluster config exception try return cache get cluster catch exception ex if log is debug enabled log debug get cluster config cluster an error occurred while attempting to retrieve configuration from cache ex throwable cause ex get cause if cause instanceof cluster config exception throw cluster config exception cause throw new cluster config exception an error occurred while attempting to retrieve configuration for cluster cluster from cache cause
retrieves the active cluster configuration object for the given partition
public double get double attribute string attribute name double default value double value string str call duration weight get attribute attribute name if str call duration weight null try value new double str call duration weight double value catch number format exception ex log warn initialize id invalid numeric value str call duration weight specified for attribute attribute name using default value of default value value default value else if log is info enabled log info initialize id value for attribute attribute name not specified using default value of default value value default value return value
returns the attribute value as a double
public boolean get boolean attribute string attribute name boolean default value boolean value string str call duration weight get attribute attribute name if str call duration weight null value boolean value of str call duration weight else if log is info enabled log info initialize id value for attribute attribute name not specified using default value of default value value default value return value
returns the attribute value as a boolean
private element generate target element parent string target id return create text element parent target element target id
generates a target element
private void generate def element def element definition def if def get description null create text element def element description element def get description generate meta data def element def get meta data
generates the xml elements and attributes that are common to all definition objects
private void generate cluster info element cluster info element cluster info cluster info cluster info element set attribute name attribute cluster info get cluster element active cluster config element create element cluster info element active cluster config element active cluster config element set attribute name attribute cluster info get config id
generate the cluster info element along with all of its children
public cluster info parse string xml boolean validate throws cluster config exception try document document parse xml validate cluster info entity resolver get instance if parser errors size 0 throw new cluster config exception errors in cluster definition parser errors to string else if parser warnings size 0 log warn warnings in cluster info definition parser warnings to string return parse document get document element catch exception ex log error parse an exception occurred while parsing cluster xml ex throw new cluster config exception an exception occurred while parsing cluster xml ex
creates a cluster info object from the given xml string
private cluster info parse element cluster throws cluster config exception string cluster name get attribute cluster name attribute element active cluster config element get child element cluster active cluster config element if active cluster config element null throw new cluster config exception mandatory element active cluster config element not found in cluster xml string active cluster config id get attribute active cluster config element name attribute return new cluster info cluster name active cluster config id
creates a cluster info object from the given cluster element
public void set override node id string node id set property node override property name node id
sets the override property for the particular node id
public void set override all nodes set override node id all nodes override property value
sets the override property for all nodes
public void reset override node id remove property node override property name
resets removes the override property
public string get override node id return get property node override property name
returns the value of the override property
public void set override state server state override state if override state default override state remove property node override state property name else set property node override state property name override state
specifies the state to override
public server state get override state return get property node override state property name default override state
returns the override state
public void reset override state remove property node override state property name
resets removes the override state property
public boolean is override return get override node id null
indicates whether the current thread is in node override mode
public string get client host return server context get instance get client host
returns the host name of the client thats making this invocation
public void set client host string client host server context get instance set client host client host
sets the host name of the client thats making this invocation
public string get client host return get property client host property
returns the host name of the client thats making this server invocation
public void set client host string client host set property client host property client host
sets the host name of the client thats making this server invocation
public long get client id return get property client id property 0 l
returns the unique id of the client thats making this server invocation
public void set inheritance inheritance inheritance this inheritance inheritance
sets the inheritance type
public void set client id long client id set property client id property client id
sets the unique id of the client thats making this server invocation
public void set meta data map string extendable string meta data if meta data null this meta data new linked hash map string extendable string meta data else this meta data collections empty map
sets the meta data for the object
public boolean is local call return get property local call property false
indicates whether the current invocation came from a client
protected void initialize string id string description set id id set description description
convenience class for subclasses to initialize all fields at once
public cluster config definition parse file file file boolean resolve nodes throws file not found exception cluster config exception return parse get xml file true resolve nodes file get parent file 0
creates a cluster config definition object from the given xml file
public node resolve map string object properties call trace begin this try if is available if log is debug enabled log debug resolve to string resolved to this node return this if log is debug enabled log debug resolve to string this node is unavailable return null finally call trace end
first tests whether or not the node is available
public cluster config manager get cluster manager remote return ref get
retrieves a remote reference from the default cluster
public cluster config manager remote get cluster manager remote string cluster return ejb3 remote reference factory create cluster config manager remote class cluster null true
retrieves a remote reference from the given cluster
public cluster config manager get cluster manager local return ref get
retrieves a remote reference from the default cluster
public server control manager get cluster manager remote return ref get
retrieves a remote reference from the default cluster
public server control manager get cluster manager remote string cluster return ejb3 remote reference factory create server control manager remote class cluster null
retrieves a remote reference from the given cluster
public server info get server info string cluster string node id return get proxy cluster get server info node id
retrieves information for the given node in the given cluster
public void invalidate string cluster long invalidation request id for long current invalidation request id this invalidation id get if invalidation request id current invalidation request id the invalidation notification was already published for the given id return ensure that only one thread publishes the invalidation request if this invalidation id compare and set current invalidation request id invalidation request id invalidate cluster break
publishes an invalidation notification to all listeners
public service control get service control return service control
returns a handle to the actual
public full node info get full node info string node id node node get nodes get node id if node null throw new runtime remote exception node node id not found for target server info server info try server info service control get server info node id true catch runtime remote exception ex server info null return new full node info node server info
retrieves detailed information for the given node in the given cluster
public server info get server info string node id node node get nodes get node id if node null throw new runtime remote exception node node id not found for target return service control get server info node id true
retrieves information for the given node in the given cluster
private node resolver create node resolver definition node resolver definition throws cluster config exception node resolver node resolver if node resolver definition instanceof node definition node resolver create node definition node resolver definition else if node resolver definition instanceof node group definition node resolver create node group definition node resolver definition else if node resolver definition instanceof delegate group definition node resolver create delegate group definition node resolver definition else throw new cluster config exception unsupported node resolver definition class node resolver definition get class get name node resolvers put node resolver get id node resolver return node resolver
creates a node resolver and all of its dependencies
private node resolver get node resolver string id throws cluster config exception node resolver node resolver node resolvers get id if node resolver null attempt to create the node resolver node resolver create get node resolver definition id return node resolver
retrieves the node resolver for the given id
private property matcher factory get property matcher factory string id throws factory not found exception property matcher factory factory property matcher factories get id if factory null throw new factory not found exception id unable to find property matcher id return factory
retrieves the property matcher factory for the given id
public server endpoint get server endpoint string name return get endpoint name
the server bind address
public cluster config definition get base config return base config
the configuration definition to be extended
private void set concurrent calls int concurrent calls global context get instance set property load factor load balance policy concurrent calls integer value of concurrent calls
sets the concurrent calls performance metric
private void set call duration long duration ns long call duration ns long duration ns normalizing factor load factor server interceptor call duration ns 1 normalizing factor load factor server interceptor call duration ns call duration ns global context get instance set property load factor load balance policy call duration ns long value of call duration ns
sets the call duration ns performance metric
public boolean has local target invocation invocation return false
whether there is a local target
public long get cluster config version return cluster config version
the cluster version view id
public long get cluster family view id return cluster family view id
the cluster family view id
public void add v node view node map put node key get key node view node view target to node map put node view get remote target node view
adds a new node target relationship
public v get node view node node return get node view node key get key node
retrieves the target that corresponds to the given node
public v get node view node key node key return node map get node key
retrieves the node view that corresponds to the given node key
public int size return node map size
the size of the map
public boolean contains node key node key return node map contains key node key
returns true if the given node key exists
public v get node view t remote target return target to node map get remote target
returns the node view for the given remote target
private void set call duration long duration ns long call duration ns long duration ns normalizing factor load factor server ejb3 interceptor call duration ns 1 normalizing factor load factor server ejb3 interceptor call duration ns call duration ns global context get instance set property load factor load balance policy call duration ns long value of call duration ns
sets the call duration ns performance metric
protected long get current view id return family cluster info get current view id
the current view id stored in the family cluster info
private void check new target object new target throws class cast exception set string new interfaces get interface names new target for string interface name interface names if new interfaces contains interface name throw new class cast exception unable to set new target since new target does not implement required interface interface name
ensure that the new target object implements at least all of the
public void set meta data string name string value extendable string old value meta data get name extendable string new value create string old value value extendable string base value if new value null meta data put name new value else if base config null base value base config get meta data get name null restore the base value meta data put name create inherited string base value else meta data remove name
sets a meta value for the given name
public void remove meta data string name throws cluster config exception if base config null base config get meta data get name null throw new cluster config exception unable to remove meta value for name name since the value was defined in the base configuration base config get id meta data remove name
removes a meta value for the given name
public void add meta data map string string meta data for map entry string string entry meta data entry set set meta data entry get key entry get value
adds all of the meta values
protected object choose target family cluster info cluster family invocation invocation string service map string object properties return super choose target cluster family invocation service properties
add the properties on the local thread
protected object get transaction propagation context transaction propagation context factory tpc factory transaction propagation context util get tpcfactory client side if log is debug enabled log debug using tpc factory tpc factory return tpc factory null null tpc factory get transaction propagation context
before invocation access to transaction propagation context is needed
public int get num threads return executors length
returns the maximum number of threads to be used
public int set size int new size int current size size get and set new size if new size current size release new size current size else if new size current size take difference away from the pool reduce permits current size new size return current size
sets the total number of permits
public int get in use return size int value available permits
returns the number of permits that are currently in use
public void execute runnable task object sync object if task null throw new null pointer exception task is null get executor sync object hash code execute task
executes the given task at some time in the future
public void initialize initialize integer max value
initializes a new rolling atomic counter with no pre set maximum
public void shutdown for executor service executor executors executor shutdown
initiates an orderly shutdown in which previously submitted
public void invalidate all log info invalidate all invalidating all cache entries cache clear
invalidates all cache entries
public void initialize int maximum if maximum 0 throw new illegal argument exception argument maximum must be greater than 0 this maximum maximum
initializes a new rolling atomic counter
public boolean exists k key return cache get key null
checks for the existence of a cached entry
public int next return next maximum
increments and returns the value of the counter
public int next int maximum int next index while true next index counter increment and get if next index maximum return next index the counter has reached the maximum attempt to reset it back to 0 if counter compare and set next index 0 return 0 if we reach here then another thread has already changed the counter try to increment again
increments and returns the value of the counter
public t get try return get ex catch interrupted exception ex throw new runtime exception the task was interrupted before the object could be created ex catch exception ex if ex instanceof runtime exception throw runtime exception ex throw new runtime exception ex
retrieve the value
public int current return counter get
returns the current value of the counter
public acquire result try acquire if queue full return acquire result qfull try return semaphore try acquire timeout secs time unit seconds acquire result acquired acquire result timeout catch interrupted exception ex log warn try aquire thread interrupted ex return acquire result timeout
attempt to acquire a permit
public boolean reset t expected value future t ft ref get try if ft null ft is done ft get expected value return ref compare and set ft null catch throwable ex ignore shouldn t happen since get is called only if the future task has already completed return false
sets the reference to null
public void set id t id this id id
sets the id of the object
public boolean is set return ref get null
indicates whether the reference has been set
public int get size return semaphore get size
returns the number of requests allowed to run concurrently
public void invalidate object key for invalidatable listener listeners if log is debug enabled log debug invalidate submitting task to invalidate listener listener executor execute new invalidation task listener key
invalidates all listeners asynchronously using a task executor
public void register listener string key invalidatable listener if log is debug enabled log debug register listener registering listener listener for key key get publisher key register listener listener
registers an invalidation listener for the given key