Package org.apache.s4.serialize

Examples of org.apache.s4.serialize.KryoSerDeser


    @Test
    public void test() throws Exception {

        Injector injector = Guice.createInjector(new Module());
        FluentApp myApp = injector.getInstance(FluentApp.class);
        Sender sender = injector.getInstance(Sender.class);
        Receiver receiver = injector.getInstance(Receiver.class);
        myApp.setCommLayer(sender, receiver);

        /* Normally. the container will handle this but this is just a test. */
        myApp.init();
View Full Code Here


    public static void main(String[] args) {

        Injector injector = Guice.createInjector(new Module());
        MyApp myApp = injector.getInstance(MyApp.class);
        Sender sender = injector.getInstance(Sender.class);
        Receiver receiver = injector.getInstance(Receiver.class);
        myApp.setCommLayer(sender, receiver);
        myApp.init();
        myApp.start();
View Full Code Here

    }

    protected void recover() {
        byte[] serializedState = null;
        try {
            serializedState = getApp().getCheckpointingFramework().fetchSerializedState(new CheckpointId(this));
        } catch (RuntimeException e) {
            logger.error("Cannot fetch serialized stated for [{}/{}]: {}", new String[] {
                    getPrototype().getClass().getName(), getId(), e.getMessage() });
        }
        if (serializedState == null) {
            return;
        }
        try {
            ProcessingElement peInOldState = deserializeState(serializedState);
            restoreState(peInOldState);
        } catch (RuntimeException e) {
            logger.error("Cannot restore state for key [" + new CheckpointId(this) + "]: " + e.getMessage(), e);
        }
    }
View Full Code Here

                        public void uncaughtException(Thread t, Throwable e) {
                            logger.error("Expection from checkpointing thread", e);
                        }
                    }).setNameFormat("Checkpointing-trigger-" + getClass().getSimpleName()).build();
            checkpointingTimer = Executors.newSingleThreadScheduledExecutor(threadFactory);
            checkpointingTimer.scheduleAtFixedRate(new CheckpointingTask(this), checkpointingConfig.frequency,
                    checkpointingConfig.frequency, checkpointingConfig.timeUnit);
            logger.debug(
                    "Started checkpointing timer for PE prototype [{}], ID [{}] with interval [{}] [{}].",
                    new String[] { this.getClass().getName(), id, String.valueOf(checkpointingConfig.frequency),
                            String.valueOf(checkpointingConfig.timeUnit.toString()) });
View Full Code Here

    transient private CheckpointingConfig checkpointingConfig = new CheckpointingConfig.Builder(CheckpointingMode.NONE)
            .build();

    protected ProcessingElement() {
        OverloadDispatcherGenerator oldg = new OverloadDispatcherGenerator(this.getClass());
        Class<?> overloadDispatcherClass = oldg.generate();
        try {
            overloadDispatcher = (OverloadDispatcher) overloadDispatcherClass.newInstance();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

                for (String namedParam : mainArgs.extraNamedParameters) {
                    namedParameters.put(namedParam.split("[=]")[0].trim(),
                            namedParam.substring(namedParam.indexOf('=') + 1).trim());
                }
                combinedModule = Modules.override(combinedModule).with(new ParametersInjectionModule(namedParameters));
            }

            injector = Guice.createInjector(combinedModule);

            if (mainArgs.appClass != null) {
View Full Code Here

        cleanupZkBasedTest();
    }

    protected CountDownLatch createTriggerAppAndSendEvent() throws IOException, KeeperException, InterruptedException {
        final ZooKeeper zk = CommTestUtils.createZkClient();
        Injector injector = Guice.createInjector(new MockCommModule(), new MockCoreModule());
        app = injector.getInstance(TriggeredApp.class);
        app.init();
        app.start();
        // app.close();
View Full Code Here

    /*
     * We inject one event and fire one onTime() event, both should be synchronized (not running in parallel)
     */
    @Test
    public void testSynchronization() throws IOException, InterruptedException {
        Injector injector = Guice.createInjector(new MockCommModule(), new MockCoreModule());
        TestApp app = injector.getInstance(TestApp.class);
        app.count = 2; // One for the event, another for the timer
        app.init();
        app.start();

View Full Code Here

    @Test
    public void test() {
        ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory
                .getLogger(Logger.ROOT_LOGGER_NAME);
        root.setLevel(Level.DEBUG);
        Injector injector = Guice.createInjector(new MockCommModule(), new MockCoreModule());
        TestTimeWindowedApp app = injector.getInstance(TestTimeWindowedApp.class);
        app.init();
        app.start();

        for (int i = 0; i < NB_EVENTS; i++) {
View Full Code Here

        CoreTestUtils.watchAndSignalCreation("/value1Set", signalValue1Set, zk);
        final CountDownLatch signalCheckpointed = new CountDownLatch(1);
        CoreTestUtils.watchAndSignalCreation("/checkpointed", signalCheckpointed, zk);

        Injector injector = Guice.createInjector(new MockCommModule(),
                new MockCoreModuleWithFileBaseCheckpointingBackend());
        TestApp app = injector.getInstance(TestApp.class);
        app.init();
        app.start();
View Full Code Here

TOP

Related Classes of org.apache.s4.serialize.KryoSerDeser

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.