本文整理汇总了Java中java.rmi.dgc.VMID类的典型用法代码示例。如果您正苦于以下问题:Java VMID类的具体用法?Java VMID怎么用?Java VMID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VMID类属于java.rmi.dgc包,在下文中一共展示了VMID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unreferenced
import java.rmi.dgc.VMID; //导入依赖的package包/类
/**
* Remove endpoint from remembered set. If set becomes empty,
* remove server from Transport's object table.
*/
synchronized void unreferenced(long sequenceNum, VMID vmid, boolean strong)
{
// check sequence number for vmid
SequenceEntry entry = sequenceTable.get(vmid);
if (entry == null || entry.sequenceNum > sequenceNum) {
// late clean call; ignore
return;
} else if (strong) {
// strong clean call; retain sequenceNum
entry.retain(sequenceNum);
} else if (entry.keep == false) {
// get rid of sequence number
sequenceTable.remove(vmid);
}
if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
DGCImpl.dgcLog.log(Log.VERBOSE, "remove from dirty set: " + vmid);
}
refSetRemove(vmid);
}
示例2: unexport
import java.rmi.dgc.VMID; //导入依赖的package包/类
/**
* Mark this target as not accepting new calls if any of the
* following conditions exist: a) the force parameter is true,
* b) the target's call count is zero, or c) the object is already
* not accepting calls. Returns true if target is marked as not
* accepting new calls; returns false otherwise.
*/
synchronized boolean unexport(boolean force) {
if ((force == true) || (callCount == 0) || (disp == null)) {
disp = null;
/*
* Fix for 4331349: unpin object so that it may be gc'd.
* Also, unregister all vmids referencing this target
* so target can be gc'd.
*/
unpinImpl();
DGCImpl dgc = DGCImpl.getDGCImpl();
Enumeration<VMID> enum_ = refSet.elements();
while (enum_.hasMoreElements()) {
VMID vmid = enum_.nextElement();
dgc.unregisterTarget(vmid, this);
}
return true;
} else {
return false;
}
}
示例3: readObject
import java.rmi.dgc.VMID; //导入依赖的package包/类
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
int version = in.readInt ();
int size = in.readInt();
entries = new ArrayList (size);
map = new gnu.trove.TObjectIntHashMap (size);
for (int i = 0; i < size; i++) {
Object o = in.readObject();
map.put (o, i);
entries. add (o);
}
growthStopped = in.readBoolean();
entryClass = (Class) in.readObject();
if (version >0 ){ // instanced id added in version 1S
instanceId = (VMID) in.readObject();
}
}
示例4: readObject
import java.rmi.dgc.VMID; //导入依赖的package包/类
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
//throw new UnsupportedOperationException();
int version = in.readInt ();
this.alphaId = (String)in.readObject();
this.entriesId = (String)in.readObject();
//this.alphabetEntries = this.getEntries();
//this.alphabetMap = this.getMap();
/*
for (int i = 0; i < size; i++) {
Object o = in.readObject();
map.put (o, i);
entries. add (o);
}
*/
growthStopped = in.readBoolean();
entryClass = (Class) in.readObject();
if (version >0 ){ // instanced id added in version 1S
instanceId = (VMID) in.readObject();
}
}
示例5: newId
import java.rmi.dgc.VMID; //导入依赖的package包/类
public static String newId() {
String result = new VMID().toString();
result = result.replace('0', 'G');
result = result.replace('1', 'H');
result = result.replace('2', 'I');
result = result.replace('3', 'J');
result = result.replace('4', 'K');
result = result.replace('5', 'L');
result = result.replace('6', 'M');
result = result.replace('7', 'N');
result = result.replace('8', 'O');
result = result.replace('9', 'P');
result = result.replaceAll("-", "");
result = result.replaceAll(":", "");
return result;
}
示例6: readObject
import java.rmi.dgc.VMID; //导入依赖的package包/类
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
lock = new ReentrantReadWriteLock();
lock.writeLock().lock();
try {
int version = in.readInt();
int size = in.readInt();
entries = new ArrayList(size);
map = new TObjectIntHashMap(size);
for (int i = 0; i < size; i++) {
Object o = in.readObject();
map.put(o, i);
entries.add(o);
}
growthStopped = in.readBoolean();
entryClass = (Class) in.readObject();
if (version > 0) { // instanced id added in version 1S
instanceId = (VMID) in.readObject();
}
} finally {
lock.writeLock().unlock();
}
}
示例7: unreferenced
import java.rmi.dgc.VMID; //导入依赖的package包/类
/**
* Remove endpoint from remembered set. If set becomes empty,
* remove server from Transport's object table.
*/
synchronized void unreferenced(long sequenceNum, VMID vmid, boolean strong)
{
// check sequence number for vmid
SequenceEntry entry = (SequenceEntry) sequenceTable.get(vmid);
if (entry == null || entry.sequenceNum > sequenceNum) {
// late clean call; ignore
return;
} else if (strong) {
// strong clean call; retain sequenceNum
entry.retain(sequenceNum);
} else if (entry.keep == false) {
// get rid of sequence number
sequenceTable.remove(vmid);
}
if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
DGCImpl.dgcLog.log(Log.VERBOSE, "remove from dirty set: " + vmid);
}
refSetRemove(vmid);
}
示例8: unexport
import java.rmi.dgc.VMID; //导入依赖的package包/类
/**
* Mark this target as not accepting new calls if any of the
* following conditions exist: a) the force parameter is true,
* b) the target's call count is zero, or c) the object is already
* not accepting calls. Returns true if target is marked as not
* accepting new calls; returns false otherwise.
*/
synchronized boolean unexport(boolean force) {
if ((force == true) || (callCount == 0) || (disp == null)) {
disp = null;
/*
* Fix for 4331349: unpin object so that it may be gc'd.
* Also, unregister all vmids referencing this target
* so target can be gc'd.
*/
unpinImpl();
DGCImpl dgc = DGCImpl.getDGCImpl();
Enumeration enum_ = refSet.elements();
while (enum_.hasMoreElements()) {
VMID vmid = (VMID) enum_.nextElement();
dgc.unregisterTarget(vmid, this);
}
return true;
} else {
return false;
}
}
示例9: readObject
import java.rmi.dgc.VMID; //导入依赖的package包/类
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
int version = in.readInt ();
int size = in.readInt();
entries = new ArrayList (size);
map = new ObjectIntOpenHashMap (size);
for (int i = 0; i < size; i++) {
Object o = in.readObject();
map.put (o, i);
entries. add (o);
}
growthStopped = in.readBoolean();
entryClass = (Class) in.readObject();
if (version >0 ){ // instanced id added in version 1S
instanceId = (VMID) in.readObject();
}
}
示例10: dgcDirty
import java.rmi.dgc.VMID; //导入依赖的package包/类
void dgcDirty(VMID vmid, long seqNum, long duration) {
synchronized (vmidTable) {
DGCExpirationInfo info = (DGCExpirationInfo) vmidTable.get(vmid);
if (info != null && info.seqNum >= seqNum) {
return;
}
Long l = (Long) rememberedTable.get(vmid);
if (l != null) {
if (l.longValue() > seqNum) {
return;
} else {
rememberedTable.remove(vmid);
}
}
ref.makeStrong(true);
vmidTable.put(vmid, new DGCExpirationInfo(duration, seqNum));
}
}
示例11: dgcClean
import java.rmi.dgc.VMID; //导入依赖的package包/类
boolean dgcClean(VMID vmid, long seqNum, boolean strong) {
synchronized (vmidTable) {
DGCExpirationInfo info = (DGCExpirationInfo) vmidTable.get(vmid);
if (info != null && info.seqNum >= seqNum) {
return false;
}
vmidTable.remove(vmid);
if (strong) {
Long l = (Long) rememberedTable.get(vmid);
if (l != null && l.longValue() > seqNum) {
return true;
}
rememberedTable.put(vmid, new Long(seqNum));
}
if (vmidTable.isEmpty()) {
unreferenced();
}
return true;
}
}
示例12: readObject
import java.rmi.dgc.VMID; //导入依赖的package包/类
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
int version = in.readInt ();
int size = in.readInt();
entries = new ArrayList (size);
map = new gnu.trove.TObjectIntHashMap (size);
for (int i = 0; i < size; i++) {
Object o = in.readObject();
map.put (o, i);
entries. add (o);
}
growthStopped = in.readBoolean();
entryClass = (Class) in.readObject();
if (version >0 ){ // instanced id added in version 1S
instanceId = (VMID) in.readObject();
}
}
示例13: readObject
import java.rmi.dgc.VMID; //导入依赖的package包/类
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
lock = new ReentrantReadWriteLock();
lock.writeLock().lock();
try {
int version = in.readInt();
int size = in.readInt();
entries = new ArrayList(size);
map = new ObjectIntHashMap(size);
for (int i = 0; i < size; i++) {
Object o = in.readObject();
map.put(o, i);
entries.add(o);
}
growthStopped = in.readBoolean();
entryClass = (Class) in.readObject();
if (version > 0) { // instanced id added in version 1S
instanceId = (VMID) in.readObject();
}
} finally {
lock.writeLock().unlock();
}
}
示例14: DGCImpl
import java.rmi.dgc.VMID; //导入依赖的package包/类
/**
* Starts all the periodic actions and Starts the local Garbage Collector
*/
public DGCImpl() {
super("rmi.dgc.server.DGCImpl");
exportedDGCQueue = new ReferenceQueue<Remote>();
dgcDataTable = new DGCDataTable();
seqNumTable = new Hashtable<VMID, Pair<Long, Long>>();
timer = new Timer(true);
try {
timer.schedule(new CleanTask(), checkInterval, checkInterval);
timer.schedule(new RipSequenceNumbersTask(), 2 * leaseProperty,
2 * leaseProperty);
DGCScheduledGC.startGC();
} catch (Exception e) {
// There is no chance that this try will fail unless the clean
// method be errased.
e.printStackTrace();
}
/*
* Runs the Thread that removes exported Objects out of scope and not
* being used remotelly.
*/
this.setDaemon(true);
this.start();
}
示例15: clean
import java.rmi.dgc.VMID; //导入依赖的package包/类
/**
* @see java.rmi.dgc.DGC#clean FIXME boolean strong is not used
*/
public final void clean(ObjID[] ids, long sequenceNum, VMID vmid,
@SuppressWarnings("unused")
boolean strong) {
/*
* REVIEW: When the strong parameter is not setted and the VMID making
* the clean call does not hold any reference to other locally exported
* object the Sequence Number for that VMID could be erased. This would
* require that there exists a way to recognize every ObjectID used by a
* particular VMID. We have chosen not to hold that table, but instead
* erase sequence Numbers for "old enough" VMID's.
*/
if (seqNumTable.containsKey(vmid)
&& sequenceNum > (Long) seqNumTable.get(vmid).getFirst()) {
seqNumTable.put(vmid, new Pair<Long, Long>(new Long(sequenceNum),
System.currentTimeMillis() + 2 * leaseProperty));
dgcDataTable.clean(ids, vmid);
} else {
// FIXME Just ignore the call?
}
}