Package org.agilewiki.jactor2.core.blades

Examples of org.agilewiki.jactor2.core.blades.NamedBlade


public class RegistrationTest extends CallTestBase {
    public void test1() throws Exception {
        new Plant();
        try {
            final NamedBlade namedBlade = new NamedBlade() {
                @Override
                public String getName() {
                    return "FooBar";
                }
            };
View Full Code Here


     */
    public SOp<NamedBlade> unregisterBladeSOp(final String _name) {
        return new SOp<NamedBlade>("unregisterBlade", Facility.this) {
            @Override
            protected NamedBlade processSyncOperation(RequestImpl _requestImpl) throws Exception {
                final NamedBlade removed = namedBladesTransmutable.remove(_name);
                if (removed != null) {
                    namedBlades = namedBladesTransmutable.createUnmodifiable();
                    registrationNotifier.signalContent(
                            new RegistrationNotification(Facility.this, _name, null), Facility.this);
                }
View Full Code Here

        validateName(name);
        return new SOp<Void>("registerBlade", getReactor()) {
            @Override
            protected Void processSyncOperation(RequestImpl _requestImpl) throws Exception {
                String name = _blade.getName();
                final NamedBlade oldBlade = namedBladesTransmutable.get(name);
                if (oldBlade != null) {
                    throw new IllegalArgumentException("duplicate blade name");
                }
                namedBladesTransmutable.put(name, _blade);
                namedBlades = namedBladesTransmutable.createUnmodifiable();
View Full Code Here

                    }
                };

        try {
            TransmutableReference<String, TransmutableString> t =
                    new TransmutableReference<String, TransmutableString>(new TransmutableString("fun"));
            System.out.println(t.getUnmodifiable()); // fun
            call(t.applyAOp(addGood));
            System.out.println(t.getUnmodifiable()); // good fun
            call(t.applyAOp(noop));
            System.out.println(t.getUnmodifiable()); // good fun
            t = new TransmutableReference<String, TransmutableString>(new TransmutableString("grapes"));
            System.out.println(t.getUnmodifiable()); // grapes
            call(t.applyAOp(addMoreGood));
            System.out.println(t.getUnmodifiable()); // more good grapes
            call(t.applyAOp(noop));
            System.out.println(t.getUnmodifiable()); // more good grapes
View Full Code Here

                    }
                };

        try {
            TransmutableReference<String, TransmutableString> t =
                    new TransmutableReference<String, TransmutableString>(new TransmutableString("fun"));
            System.out.println(t.getUnmodifiable()); // fun
            call(t.applyAOp(addGood));
            System.out.println(t.getUnmodifiable()); // good fun
            call(t.applyAOp(noop));
            System.out.println(t.getUnmodifiable()); // good fun
            t = new TransmutableReference<String, TransmutableString>(new TransmutableString("grapes"));
            System.out.println(t.getUnmodifiable()); // grapes
            call(t.applyAOp(addMoreGood));
            System.out.println(t.getUnmodifiable()); // more good grapes
            call(t.applyAOp(noop));
            System.out.println(t.getUnmodifiable()); // more good grapes
            t = new TransmutableReference<String, TransmutableString>(new TransmutableString("times"));
            System.out.println(t.getUnmodifiable()); // times
            try {
                call(t.applyAOp(bogus));
            } catch (final Exception e) {
                System.out.println("*** " + e);
View Full Code Here

            assertEquals("no way", msg);
            assertEquals(1, immutableState.size());
            immutableState = propertiesReference.getUnmodifiable();
            assertEquals(1, immutableState.size());

            TSSMUpdateTransaction ut = new TSSMUpdateTransaction<String>("1", (String) null);
            call(propertiesReference.applyAOp(ut));
            System.out.println(ut);
            immutableState = propertiesReference.getUnmodifiable();
            assertEquals(0, immutableState.size());
        } finally {
View Full Code Here

        if (closeables != null) {
            final HashSet<Closeable> hs = new HashSet<Closeable>(closeables);
            Iterator<Closeable> cit = hs.iterator();
            while (cit.hasNext()) {
                final Closeable closeable = cit.next();
                try {
                    closeable.close();
                } catch (final Throwable t) {
                    if ((closeable != null) && PlantMtImpl.DEBUG) {
                        getLogger().warn(
                                "Error closing a "
                                        + closeable.getClass().getName(), t);
                    }
                }
            }
            cit = closeables.iterator();
            while (cit.hasNext()) {
                final Closeable closeable = cit.next();
                warn("still has closable: " + this + "\n" + closeable);
            }
        }

        shuttingDown = true;
View Full Code Here

                recovery.onMessageTimeout(this);
            }
        }
        final Iterator<Closeable> it = getCloseableSet().iterator();
        while (it.hasNext()) {
            final Closeable closeable = it.next();
            if (!(closeable instanceof ReactorMtImpl)) {
                continue;
            }
            final ReactorMtImpl reactor = (ReactorMtImpl) closeable;
            reactor.reactorPoll();
View Full Code Here

class MyCloseable implements Closeable {
    public volatile int closed;
    CloseableImpl closeableImpl;

    MyCloseable() throws Exception {
        closeableImpl = new CloseableImplImpl(this);
    }
View Full Code Here

     * @param _initialBufferSize     The initial size of a send buffer.
     * @param _initialLocalQueueSize The initial size of the local queue.
     */
    public ReactorMtImpl(final NonBlockingReactor _parentReactor,
            final int _initialBufferSize, final int _initialLocalQueueSize) {
        closeableImpl = new CloseableImplImpl(this);
        final PlantConfiguration plantConfiguration = PlantMtImpl
                .getSingleton().getPlantConfiguration();
        @SuppressWarnings("resource")
        final NonBlockingReactorMtImpl parentReactorImpl = _parentReactor == null ? null
                : (NonBlockingReactorMtImpl) _parentReactor.asReactorImpl();
View Full Code Here

TOP

Related Classes of org.agilewiki.jactor2.core.blades.NamedBlade

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.