当前位置: 首页>>代码示例>>Java>>正文


Java UniqueID类代码示例

本文整理汇总了Java中org.objectweb.proactive.core.UniqueID的典型用法代码示例。如果您正苦于以下问题:Java UniqueID类的具体用法?Java UniqueID怎么用?Java UniqueID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UniqueID类属于org.objectweb.proactive.core包,在下文中一共展示了UniqueID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connect

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 * Connect a new user on the scheduler. This user can interact with the
 * scheduler according to his right.
 *
 * @param sourceBodyID
 *            the source ID of the connected object representing a user
 * @param identification
 *            the identification of the connected user
 * @throws SchedulerException
 *             If an error occurred during connection with the front-end.
 */
synchronized void connect(UniqueID sourceBodyID, UserIdentificationImpl identification, Credentials cred)
        throws AlreadyConnectedException {
    if (identifications.containsKey(sourceBodyID)) {
        logger.warn("Active object already connected for this user :" + identification.getUsername());
        throw new AlreadyConnectedException("This active object is already connected to the scheduler !");
    }
    logger.info(identification.getUsername() + " successfully connected !");
    identifications.put(sourceBodyID, new ListeningUser(identification));
    credentials.put(sourceBodyID, cred);
    renewUserSession(sourceBodyID, identification);
    // add this new user in the list of connected user
    sState.getUsers().update(identification);
    // send events
    usersUpdated(new NotificationData<UserIdentification>(SchedulerEvent.USERS_UPDATE, identification));
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:27,代码来源:SchedulerFrontendState.java

示例2: renewUserSession

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 * Create or renew the session (timer task) for the given user
 * identification. A call to this method will cancel the previous session
 * (timerTask), create and schedule a new one and purge the timer.
 * 
 * @param id
 *            The unique ID of the user
 * @param identification
 *            the user on which to renew the session
 */
private void renewUserSession(final UniqueID id, UserIdentificationImpl identification) {
    if (identifications.get(id).isListening()) {
        // if this id has a listener, do not renew user session
        return;
    }
    final String userName = identification.getUsername();
    TimerTask session = identification.getSession();
    if (session != null) {
        session.cancel();
    }
    identification.setSession(new TimerTask() {
        @Override
        public void run() {
            logger.info("End of session for user " + userName + ", id=" + id);
            disconnect(id);
        }
    });
    sessionTimer.purge();
    sessionTimer.schedule(identification.getSession(), USER_SESSION_DURATION);
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:31,代码来源:SchedulerFrontendState.java

示例3: checkPermissionReturningListeningUser

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
synchronized ListeningUser checkPermissionReturningListeningUser(String methodName, String permissionMsg)
        throws NotConnectedException, PermissionException {
    UniqueID id = checkAccess();

    ListeningUser ident = identifications.get(id);
    // renew session for this user
    renewUserSession(id, ident.getUser());

    final String fullMethodName = SchedulerFrontend.class.getName() + "." + methodName;
    final MethodCallPermission methodCallPermission = new MethodCallPermission(fullMethodName);

    try {
        ident.getUser().checkPermission(methodCallPermission, permissionMsg);
    } catch (PermissionException ex) {
        logger.warn(permissionMsg);
        throw ex;
    }
    return ident;
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:20,代码来源:SchedulerFrontendState.java

示例4: disconnect

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 * Disconnect a user, remove and clean user dependent lists and objects
 * 
 * @param id
 *            the uniqueID of the user
 */
private synchronized void disconnect(UniqueID id) {
    credentials.remove(id);
    ListeningUser ident = identifications.remove(id);
    if (ident != null) {
        // remove listeners if needed
        ident.clearListener();
        // remove this user to the list of connected user if it has not
        // already been removed
        ident.getUser().setToRemove();
        sState.getUsers().update(ident.getUser());
        // cancel the timer
        ident.getUser().getSession().cancel();
        // log and send events
        String user = ident.getUser().getUsername();
        logger.info("User '" + user + "' has disconnect the scheduler !");
        dispatchUsersUpdated(new NotificationData<UserIdentification>(SchedulerEvent.USERS_UPDATE, ident.getUser()),
                             false);
    }
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:26,代码来源:SchedulerFrontendState.java

示例5: clearListeners

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 * Clear every dirty listeners that are no more responding
 */
private void clearListeners() {
    Set<UniqueID> toRemove;

    synchronized (dirtyList) {
        if (dirtyList.isEmpty()) {
            return;
        }
        toRemove = new HashSet<>(dirtyList);
        dirtyList.clear();
    }

    for (UniqueID uId : toRemove) {
        disconnect(uId);
    }
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:19,代码来源:SchedulerFrontendState.java

示例6: addHostToFilename

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
private void addHostToFilename(FileAppender fileApp) {
    String hostID = Math.abs(UniqueID.getCurrentVMID().hashCode() % 100000) + "-" +
                    ProActiveInet.getInstance().getHostname();
    String fileName = fileApp.getFile();
    File filePath = new File(fileName);
    String hostFileName;
    String name = filePath.getName();
    String pathToFile = filePath.getParent();
    int point = name.indexOf('.');
    if (point == -1) {
        hostFileName = fileName + "-" + hostID;
    } else {
        String extension = name.substring(point + 1);
        String nameNoExtension = name.substring(0, point);
        hostFileName = (pathToFile != null ? pathToFile : "") + File.separator + nameNoExtension + "-" + hostID +
                       "." + extension;
    }
    System.out.println("New output file:" + hostFileName);
    fileApp.setFile(hostFileName);
    fileApp.activateOptions();
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:22,代码来源:ActiveActor.java

示例7: addRMEventListener

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/** Register a new Resource manager listener.
 * Way to a monitor object to ask at RMMonitoring to throw
 * RM events to it.
 * @param stub a listener object which implements {@link RMEventListener}
 * interface.
 * @param events list of wanted events that must be received.
 * @return RMInitialState snapshot of RM's current state : nodes and node sources.
 *  */
public RMInitialState addRMEventListener(RMEventListener stub, RMEventType... events) {
    UniqueID id = PAActiveObject.getContext().getCurrentRequest().getSourceBodyID();

    logger.debug("Adding the RM listener for " + id.shortString());
    synchronized (dispatchers) {
        Client client = null;
        synchronized (RMCore.clients) {
            client = RMCore.clients.get(id);
        }
        if (client == null) {
            throw new IllegalArgumentException("Unknown client " + id.shortString());
        }

        if (stub instanceof RMGroupEventListener) {
            this.dispatchers.put(id, new GroupEventDispatcher(client, stub, events));
        } else {
            this.dispatchers.put(id, new EventDispatcher(client, stub, events));
        }
    }
    return rmcore.getRMInitialState();
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:30,代码来源:RMMonitoringImpl.java

示例8: checkMethodCallPermission

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 * Checks if the caller thread has permissions to call particular method name
 *
 * @return client object corresponding to the caller thread
 */
private Client checkMethodCallPermission(final String methodName, UniqueID clientId) {
    Client client = RMCore.clients.get(clientId);

    if (client == null) {
        // Check if the client id is a local body or half body
        LocalBodyStore lbs = LocalBodyStore.getInstance();
        if (lbs.getLocalBody(clientId) != null || lbs.getLocalHalfBody(clientId) != null) {
            return RMCore.localClient;
        }

        throw new NotConnectedException("Client " + clientId.shortString() +
                                        " is not connected to the resource manager");
    }

    final String fullMethodName = RMCore.class.getName() + "." + methodName;
    final MethodCallPermission methodCallPermission = new MethodCallPermission(fullMethodName);

    client.checkPermission(methodCallPermission, client + " is not authorized to call " + fullMethodName);
    return client;
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:26,代码来源:RMCore.java

示例9: equals

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
@Override
public boolean equals(Object anObject) {
    if (Interface.class.isAssignableFrom(anObject.getClass())) {

        Interface itf = (Interface) anObject;
        boolean nameEquality = itf.getFcItfName().equals(name);

        // Are the two itf belong to the same component?
        UniqueID objectID = ((PAComponentRepresentativeImpl) itf.getFcItfOwner()).getID();
        UniqueID thisID = ((PAComponentRepresentativeImpl) owner).getID();
        boolean ownerEquality = objectID.equals(thisID);

        return nameEquality && ownerEquality;
    }
    return false;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:17,代码来源:PAInterfaceImpl.java

示例10: init

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 * FTManager initialization.
 * @param owner the attached body.
 */
@Override
public int init(AbstractBody owner) throws ProActiveException {
    super.init(owner);
    this.latestReceivedIndex = new Hashtable<UniqueID, MutableLong>();
    this.isRecovering = false;
    //checkpoint timer init: a checkpoint must be taken before any request service
    this.checkpointTimer = 0;
    // this.checkpointTimer = System.currentTimeMillis();
    this.sendNumber = 0;
    this.replyInfos = new MessageInfoPMLRB();
    this.requestInfos = new MessageInfoPMLRB();
    this.potentialDuplicataSender = null;
    this.potentialDuplicataSequence = 0;
    logger.info(" PML fault-tolerance is enabled for body " + this.ownerID);
    return 0;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:21,代码来源:FTManagerPMLRB.java

示例11: buildMessageForProxy

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 * Build the message we are going to send to the referenced p
 */
private GCSimpleMessage buildMessageForProxy(boolean isMyActivity, Referenced parent, Referenced p) {
    boolean consensus = false;
    GCSimpleResponse resp = p.getLastResponse();
    if (!isBusy() && (resp != null) && resp.getConsensusActivity().equals(this.lastActivity) &&
        (isMyActivity || (parent != null))) {
        consensus = true;
        if (p.equals(parent)) {
            for (Map.Entry<UniqueID, Referencer> entry : this.referencers.entrySet()) {
                Referencer kr = entry.getValue();
                boolean krConsensus = kr.getConsensus(this.lastActivity);
                consensus = consensus && krConsensus;
                if (!consensus) {
                    break;
                }
            }
        }
    }
    return new GCSimpleMessage(p, this.body.getID(), consensus, this.lastActivity);
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:23,代码来源:GarbageCollector.java

示例12: getBody

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 *  Search a Body matching with a given unique ID
 * @param id The unique id of the body we are searching for
 * @return The body associated with the ID
 */
public static Body getBody(UniqueID id) {
    LocalBodyStore bodyStore = LocalBodyStore.getInstance();

    // check if the id corresponds to a local body

    Body body = bodyStore.getLocalBody(id);
    if (body != null) {
        return body;
    }

    // the reference does not belong to an active object
    // looking for an half body

    body = bodyStore.getLocalHalfBody(id);
    if (body != null) {
        return body;
    }

    // the id does not correspond to a local body
    // neither a half body, could be a forwarder

    body = bodyStore.getForwarder(id);
    return body;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:30,代码来源:HttpUtils.java

示例13: updateLocalVectorClock

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
private void updateLocalVectorClock(Hashtable<UniqueID, MutableLong> vectorClock) {
    Enumeration<UniqueID> ids = vectorClock.keys();
    MutableLong localClock;
    MutableLong senderClock = null;
    UniqueID id = null;
    while (ids.hasMoreElements()) {
        id = ids.nextElement();
        localClock = (this.localVectorClock.get(id));
        senderClock = (vectorClock.get(id));
        if (localClock == null) {
            // there is no clock for the AO id
            this.localVectorClock.put(id, new MutableLong(senderClock.getValue()));
        } else if (localClock.isLessThan(senderClock)) {
            // local clock is not uptodate
            localClock.setValue(senderClock.getValue());
        }
    }
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:19,代码来源:FTManagerCIC.java

示例14: initialize

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 * Reintialize the server.
 */
@Override
public void initialize() throws RemoteException {
    super.initialize();
    this.stateMonitor = new Hashtable<MutableInteger, MutableInteger>();
    this.lastGlobalState = 0;
    this.greatestCommitedHistory = new Hashtable<UniqueID, MutableInteger>();
    this.recoveryLineMonitor = new Hashtable<MutableInteger, MutableInteger>();
    this.recoveryLine = 0;
    this.lastRegisteredCkpt = 0;
    this.globalIncarnation = 1;
    this.histories = new Hashtable<UniqueID, ReceptionHistory>();
    // kill GC thread
    gc.killMe();
    gc = new ActiveQueue("ActiveQueue: GC");
    gc.start();
    gc.addJob(new GarbageCollectionJob(this, DEFAULT_GC_PERIOD));
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:21,代码来源:CheckpointServerCIC.java

示例15: updateLocation

import org.objectweb.proactive.core.UniqueID; //导入依赖的package包/类
/**
 * @see org.objectweb.proactive.core.body.ft.servers.location.LocationServer#updateLocation(org.objectweb.proactive.core.UniqueID, org.objectweb.proactive.core.body.UniversalBody)
 */
public void updateLocation(UniqueID id, UniversalBody newLocation) throws RemoteException {
    synchronized (this.locations) {
        UniversalBody currentLocation = (this.locations.get(id));
        if (newLocation == null) {
            // the body id is no more localized. Remove it from the location table
            logger.info("[LOCATION] " + id + " is removed from the location table");
            this.locations.remove(id);
            return;
        } else if (currentLocation == null) {
            // register the location
            this.locations.put(id, newLocation);
        } else {
            if (currentLocation.equals(newLocation)) {
                logger.info("[LOCATION] location of " + id + " is already " + newLocation.getNodeURL());
            } else {
                logger.info("[LOCATION] " + id + " is updating its location : " +
                    newLocation.getNodeURL());
                this.locations.put(id, newLocation);
            }
        }
    }
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:26,代码来源:LocationServerImpl.java


注:本文中的org.objectweb.proactive.core.UniqueID类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。