public class SerialHandle extends org.codehaus.groovy.util.ManagedReference<WithSerialId>
While subscribed by remote nodes it keeps object alive by holding strong reference (anchor) to it
Modifier and Type | Class and Description |
---|---|
private static class |
SerialHandle.LocalSerialHandle |
private static class |
SerialHandle.RemoteSerialHandle |
Modifier and Type | Field and Description |
---|---|
private WithSerialId |
anchor |
private static org.codehaus.groovy.util.ReferenceBundle |
bundle |
protected SerialContext |
context
local host
|
private static org.codehaus.groovy.util.ReferenceManager |
manager |
private static java.lang.ref.ReferenceQueue<WithSerialId> |
queue |
protected java.util.UUID |
serialId
serial id of the object
|
private java.lang.Object |
subscribers
remote hosts subscribed to this objects
|
Modifier | Constructor and Description |
---|---|
private |
SerialHandle(WithSerialId value,
java.util.UUID id)
Construct handle for object with given id to it
|
Modifier and Type | Method and Description |
---|---|
static SerialHandle |
create(WithSerialId obj,
java.util.UUID id) |
void |
finalizeReference() |
java.util.UUID |
getSerialId()
Serial id of the object
|
java.lang.Object |
getSubscribers()
Getter for subscribers
|
void |
subscribe(SerialContext context)
Subscribes host as interested in the object
|
void |
unsubscribe(SerialContext context) |
private static final java.lang.ref.ReferenceQueue<WithSerialId> queue
private static final org.codehaus.groovy.util.ReferenceManager manager
private static final org.codehaus.groovy.util.ReferenceBundle bundle
protected final java.util.UUID serialId
protected final SerialContext context
private volatile java.lang.Object subscribers
private volatile WithSerialId anchor
private SerialHandle(WithSerialId value, java.util.UUID id)
value
- The value to associate with the idid
- The id, if null a new id will be generatedpublic java.util.UUID getSerialId()
public void finalizeReference()
finalizeReference
in interface org.codehaus.groovy.util.Finalizable
finalizeReference
in class org.codehaus.groovy.util.ManagedReference<WithSerialId>
public java.lang.Object getSubscribers()
public void subscribe(SerialContext context)
context
- The subscription context to usepublic void unsubscribe(SerialContext context)
public static SerialHandle create(WithSerialId obj, java.util.UUID id)