Package krati.retention.clock

Examples of krati.retention.clock.ClockSerializer


        // STEP-1
        // Create simple event retention
        RetentionConfig<String> config = new RetentionConfig<String>(0, new File(homeDir, "EventBus"));
        config.setBatchSize(3000);
        config.setEventValueSerializer(new StringSerializer());
        config.setEventClockSerializer(new ClockSerializer());
        Retention<String> eventRetention = new SimpleRetention<String>(config);
       
        // STEP-2
        // Create water marks based vector clock
        List<String> sources = new ArrayList<String>();
View Full Code Here


        // STEP-1
        // Create simple event retention
        RetentionConfig<Integer> config = new RetentionConfig<Integer>(0, new File(homeDir, "EventBus"));
        config.setBatchSize(3000);
        config.setEventValueSerializer(new IntSerializer());
        config.setEventClockSerializer(new ClockSerializer());
        Retention<Integer> eventRetention = new SimpleRetention<Integer>(config);
       
        // STEP-2
        // Create water marks based vector clock
        List<String> sources = new ArrayList<String>();
View Full Code Here

    protected EventBatchSerializer<T> createBatchSerializer() {
        return new SimpleEventBatchSerializer<T>(createEventValueSerializer(), createEventClockSerializer());
    }
   
    protected Serializer<Clock> createEventClockSerializer() {
        return new ClockSerializer();
    }
View Full Code Here

            assertTrue(true);
        }
    }
   
    public void testClockSerializer() {
        ClockSerializer serializer = new ClockSerializer();
        RandomClockFactory f = new RandomClockFactory(5);
        Clock c = f.next();
       
        byte[] raw = c.toByteArray();
        Clock c2 = Clock.parseClock(raw);
        Clock c3 = serializer.deserialize(raw);
       
        assertEquals(Occurred.EQUICONCURRENTLY, c.compareTo(c2));
        assertEquals(Occurred.EQUICONCURRENTLY, c.compareTo(c3));
       
        String str = c.toString();
View Full Code Here

    protected EventBatchSerializer<K> createBatchSerializer() {
        return new SimpleEventBatchSerializer<K>(createEventValueSerializer(), createEventClockSerializer());
    }
   
    protected Serializer<Clock> createEventClockSerializer() {
        return new ClockSerializer();
    }
View Full Code Here

        batch.setCompletionTime(System.currentTimeMillis());
       
        EventBatchHeader header = batch.getHeader();
       
        SimpleEventBatchSerializer<String> batchSerializer =
            new SimpleEventBatchSerializer<String>(new StringSerializer(), new ClockSerializer());
        byte[] bytes = batchSerializer.serialize(batch);
        EventBatch<String> batch2 = batchSerializer.deserialize(bytes);
        EventBatchHeader header2 = batch2.getHeader();
       
        assertEquals(header.getVersion(), header2.getVersion());
View Full Code Here

TOP

Related Classes of krati.retention.clock.ClockSerializer

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.