com.sun.jini.jeri.internal.runtime
Class Target

java.lang.Object
  extended by com.sun.jini.jeri.internal.runtime.Target

final class Target
extends Object

A Target represents a remote object, exported by BasicJeriExporter. Based on original ObjectTable.Target, modified to support forced interrupted unexport.

Since:
2.2.0
Author:
Peter Firmstone

Field Summary
private  boolean allowDGC
           
private  Collection<Thread> calls
           
private  ClassLoader ccl
           
private  boolean decrementedKeepAlive
           
private  boolean exported
           
private  Uuid id
           
private  ImplRefManager.ImplRef implRef
           
private  boolean interrupted
           
private  InvocationDispatcher invocationDispatcher
           
private  boolean keepAlive
           
private  JvmLifeSupport keepAliveCount
           
private  java.util.concurrent.locks.Lock lock
           
private static Logger logger
           
private  ObjectTable objTable
           
private  Set<Uuid> referencedSet
           
private  DgcRequestDispatcher[] requestDispatchers
           
private  SecurityContext securityContext
           
private  Map<Uuid,SequenceEntry> sequenceTable
           
private  boolean success
           
private  boolean unexported
           
 
Constructor Summary
Target(Uuid id, DgcRequestDispatcher[] requestDispatchers, boolean allowDGC, boolean keepAlive, ObjectTable table, SecurityContext sc, ClassLoader contextCl, JvmLifeSupport counter)
          Construction must be directly followed by three calls.
 
Method Summary
(package private)  void collect()
           
private  void decrementKeepAliveCount()
           
(package private)  void dispatch(InboundRequest request)
           
private  void dispatch(InboundRequest request, InvocationDispatcher id, Remote impl)
           
private  void dispatch(InboundRequest request, InvocationDispatcher id, Remote impl, Thread t)
           
(package private)  ClassLoader getContextClassLoader()
           
(package private)  boolean getEnableDGC()
           
(package private)  Uuid getObjectIdentifier()
           
(package private)  SecurityContext getSecurityContext()
           
private  void interrupted(Thread currentThread)
           
(package private)  void leaseExpired(Uuid clientID)
           
(package private)  void procRequestDispatchers()
          Must be synchronized externally by the object table.
(package private)  void referenced(Uuid clientID, long sequenceNum)
           
(package private)  void setExported()
          This method is called after construction, processing RequestDispatchers, creating and setting an ImplRef.
(package private)  void setImplRef(ImplRefManager.ImplRef implRef)
          Set the ImplRef.
(package private)  void setInvocationDispatcher(InvocationDispatcher id)
           
 String toString()
           
(package private)  boolean unexport(boolean force)
          To quote the Exporter interface: If the remote object is unexported as a result of this method, then the implementation may (and should, if possible) prevent remote calls in progress from being able to communicate their results successfully.
(package private)  void unreferenced(Uuid clientID, long sequenceNum, boolean strong)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static final Logger logger

implRef

private volatile ImplRefManager.ImplRef implRef

id

private final Uuid id

requestDispatchers

private final DgcRequestDispatcher[] requestDispatchers

allowDGC

private final boolean allowDGC

keepAlive

private final boolean keepAlive

securityContext

private final SecurityContext securityContext

ccl

private final ClassLoader ccl

lock

private final java.util.concurrent.locks.Lock lock

invocationDispatcher

private volatile InvocationDispatcher invocationDispatcher

exported

private volatile boolean exported

unexported

private volatile boolean unexported

success

private volatile boolean success

interrupted

private volatile boolean interrupted

referencedSet

private final Set<Uuid> referencedSet

sequenceTable

private final Map<Uuid,SequenceEntry> sequenceTable

keepAliveCount

private final JvmLifeSupport keepAliveCount

decrementedKeepAlive

private volatile boolean decrementedKeepAlive

objTable

private final ObjectTable objTable

calls

private final Collection<Thread> calls
Constructor Detail

Target

Target(Uuid id,
       DgcRequestDispatcher[] requestDispatchers,
       boolean allowDGC,
       boolean keepAlive,
       ObjectTable table,
       SecurityContext sc,
       ClassLoader contextCl,
       JvmLifeSupport counter)
 throws ExportException
Construction must be directly followed by three calls. procRequestDispatchers() setImplRef(ImplRef implRef) export()

Parameters:
id -
requestDispatchers -
allowDGC -
keepAlive -
table -
sc -
contextCl -
counter -
Throws:
ExportException
Method Detail

procRequestDispatchers

void procRequestDispatchers()
                      throws ExportException
Must be synchronized externally by the object table. Synchronization cannot be performed by a class lock, there may be more than one object table. Unsynchronized method.

Throws:
ExportException

setImplRef

void setImplRef(ImplRefManager.ImplRef implRef)
          throws ExportException
Set the ImplRef. Unsynchronized method, with volatile internal visibility, set after construction, prior to setExport.

Parameters:
implRef -
Throws:
ExportException

setInvocationDispatcher

void setInvocationDispatcher(InvocationDispatcher id)

setExported

void setExported()
           throws ExportException
This method is called after construction, processing RequestDispatchers, creating and setting an ImplRef. It should not be called if the object has been unexported. Unsynchronized method.

Throws:
ExportException

decrementKeepAliveCount

private void decrementKeepAliveCount()

unexport

boolean unexport(boolean force)
To quote the Exporter interface: If the remote object is unexported as a result of this method, then the implementation may (and should, if possible) prevent remote calls in progress from being able to communicate their results successfully. To comply with the above, dispatch call interruption has been added.

Parameters:
force - - if true forcibly unexported
Returns:
true - if unexport successful

collect

void collect()

getObjectIdentifier

Uuid getObjectIdentifier()

getEnableDGC

boolean getEnableDGC()

getSecurityContext

SecurityContext getSecurityContext()

getContextClassLoader

ClassLoader getContextClassLoader()

referenced

void referenced(Uuid clientID,
                long sequenceNum)

unreferenced

void unreferenced(Uuid clientID,
                  long sequenceNum,
                  boolean strong)

leaseExpired

void leaseExpired(Uuid clientID)

interrupted

private void interrupted(Thread currentThread)
                  throws InterruptedException
Throws:
InterruptedException

dispatch

void dispatch(InboundRequest request)
        throws IOException,
               ObjectTable.NoSuchObject
Throws:
IOException
ObjectTable.NoSuchObject

dispatch

private void dispatch(InboundRequest request,
                      InvocationDispatcher id,
                      Remote impl,
                      Thread t)
               throws IOException,
                      ObjectTable.NoSuchObject
Throws:
IOException
ObjectTable.NoSuchObject

dispatch

private void dispatch(InboundRequest request,
                      InvocationDispatcher id,
                      Remote impl)
               throws IOException,
                      InterruptedException
Throws:
IOException
InterruptedException

toString

public String toString()
Overrides:
toString in class Object


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.