61 * @author Ann Wollrath
62 * @author Peter Jones
63 **/
64 public class DGCAckHandler {
65
66 /** timeout for holding references without receiving an acknowledgment */
67 private static final long dgcAckTimeout = // default 5 minutes
68 AccessController.doPrivileged(
69 new GetLongAction("sun.rmi.dgc.ackTimeout", 300000));
70
71 /** thread pool for scheduling delayed tasks */
72 private static final ScheduledExecutorService scheduler =
73 AccessController.doPrivileged(
74 new RuntimeUtil.GetInstanceAction()).getScheduler();
75
76 /** table mapping ack ID to handler */
77 private static final Map<UID,DGCAckHandler> idTable =
78 Collections.synchronizedMap(new HashMap<UID,DGCAckHandler>());
79
80 private final UID id;
81 private List<Object> objList = new ArrayList<Object>(); // null if released
82 private Future<?> task = null;
83
84 /**
85 * Creates a new DGCAckHandler, associated with the specified UID
86 * if the argument is not null.
87 *
88 * References added to this DGCAckHandler will be held strongly
89 * until its "release" method is invoked or (after the
90 * "startTimer" method has been invoked) the timeout has expired.
91 * If the argument is not null, then invoking the static
92 * "received" method with the specified UID is equivalent to
93 * invoking this instance's "release" method.
94 **/
95 DGCAckHandler(UID id) {
96 this.id = id;
97 if (id != null) {
98 assert !idTable.containsKey(id);
99 idTable.put(id, this);
100 }
101 }
|
61 * @author Ann Wollrath
62 * @author Peter Jones
63 **/
64 public class DGCAckHandler {
65
66 /** timeout for holding references without receiving an acknowledgment */
67 private static final long dgcAckTimeout = // default 5 minutes
68 AccessController.doPrivileged(
69 new GetLongAction("sun.rmi.dgc.ackTimeout", 300000));
70
71 /** thread pool for scheduling delayed tasks */
72 private static final ScheduledExecutorService scheduler =
73 AccessController.doPrivileged(
74 new RuntimeUtil.GetInstanceAction()).getScheduler();
75
76 /** table mapping ack ID to handler */
77 private static final Map<UID,DGCAckHandler> idTable =
78 Collections.synchronizedMap(new HashMap<UID,DGCAckHandler>());
79
80 private final UID id;
81 private List<Object> objList = new ArrayList<>(); // null if released
82 private Future<?> task = null;
83
84 /**
85 * Creates a new DGCAckHandler, associated with the specified UID
86 * if the argument is not null.
87 *
88 * References added to this DGCAckHandler will be held strongly
89 * until its "release" method is invoked or (after the
90 * "startTimer" method has been invoked) the timeout has expired.
91 * If the argument is not null, then invoking the static
92 * "received" method with the specified UID is equivalent to
93 * invoking this instance's "release" method.
94 **/
95 DGCAckHandler(UID id) {
96 this.id = id;
97 if (id != null) {
98 assert !idTable.containsKey(id);
99 idTable.put(id, this);
100 }
101 }
|