Package org.rhq.enterprise.communications.util.ConcurrencyManager

Examples of org.rhq.enterprise.communications.util.ConcurrencyManager.Permit


        assert null != cm.getPermit(null); // this is allowed and just a no-op
        cm.releasePermit(cm.getPermit(null)); // this is allowed and just a no-op
        cm.releasePermit(null); // this is allowed and just a no-op

        Permit permit = cm.getPermit(foo);
        assert permit != null;
        cm.releasePermit(permit);

        permit = cm.getPermit(foo); // 1
        assert permit != null;
View Full Code Here


        HashMap<String, Integer> map = new HashMap<String, Integer>();
        map.put(foo, 0);
        ConcurrencyManager cm1 = new ConcurrencyManager(map);

        Permit permit1 = cm1.getPermit(foo);
        assert permit1 != null;
        cm1.releasePermit(permit1);

        map = new HashMap<String, Integer>();
        map.put(foo, -1); // negative, just like it was 0
        ConcurrencyManager cm2 = new ConcurrencyManager(map);

        Permit permit2 = cm2.getPermit(foo);
        assert permit2 != null;
        cm2.releasePermit(permit2);
        cm2.releasePermit(permit1); // a no-op since permit1 wasn't granted by cm2
    }
View Full Code Here

        String method_name = invocation.getMethodName();
        Object[] params = invocation.getParameters();
        String[] signature = invocation.getSignature();
        Class<?>[] class_signature = new Class[signature.length];

        Permit permit = null;
        Method pojo_method = null;

        RemotePojoInvocationCommandResponse response;

        ConcurrencyManager concurrency_manager = getServiceContainer().getConcurrencyManager();
View Full Code Here

     *
     * @see CommandListener#receivedCommand(Command)
     */
    public void receivedCommand(Command command) {
        try {
            Permit permit = this.serviceContainer.getConcurrencyManager().getPermit(CONCURRENCY_LIMIT_NAME);
            this.permitsObtained.add(permit);
        } catch (NotPermittedException npe) {
            LOG.debug(CommI18NResourceKeys.COMMAND_NOT_PERMITTED, command, npe.getSleepBeforeRetry());
            this.droppedCommands.release(); // adds 1 to the semaphore count so we know we dropped another command
            throw npe; // command processor will get this and abort the command
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.communications.util.ConcurrencyManager.Permit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.