コード例 #1
0
ファイル: PublicationTest.java プロジェクト: real-logic/Aeron
  @Before
  public void setUp() {
    when(publicationLimit.getVolatile()).thenReturn(2L * SEND_BUFFER_CAPACITY);
    when(logBuffers.termBuffers()).thenReturn(termBuffers);
    when(logBuffers.termLength()).thenReturn(TERM_MIN_LENGTH);
    when(logBuffers.metaDataBuffer()).thenReturn(logMetaDataBuffer);
    when(conductor.mainLock()).thenReturn(conductorLock);

    initialTermId(logMetaDataBuffer, TERM_ID_1);
    timeOfLastStatusMessage(logMetaDataBuffer, 0);

    for (int i = 0; i < PARTITION_COUNT; i++) {
      termBuffers[i] = new UnsafeBuffer(allocateDirect(TERM_MIN_LENGTH));
    }

    publication =
        new Publication(
            conductor,
            CHANNEL,
            STREAM_ID_1,
            SESSION_ID_1,
            publicationLimit,
            logBuffers,
            CORRELATION_ID);

    publication.incRef();

    initialiseTailWithTermId(logMetaDataBuffer, PARTITION_INDEX, TERM_ID_1);
  }
コード例 #2
0
ファイル: Publication.java プロジェクト: krisskross/Aeron
 /** Release resources and forcibly close the Publication regardless of reference count. */
 void release() {
   if (!isClosed) {
     isClosed = true;
     clientConductor.releasePublication(this);
     logBuffers.close();
   }
 }
コード例 #3
0
ファイル: PublicationTest.java プロジェクト: real-logic/Aeron
 @Test
 public void shouldReportThatPublicationHasBeenConnectedYet() {
   when(conductor.isPublicationConnected(anyLong())).thenReturn(true);
   assertTrue(publication.isConnected());
 }
コード例 #4
0
ファイル: PublicationTest.java プロジェクト: real-logic/Aeron
 @Test
 public void shouldReportThatPublicationHasNotBeenConnectedYet() {
   when(publicationLimit.getVolatile()).thenReturn(0L);
   when(conductor.isPublicationConnected(anyLong())).thenReturn(false);
   assertFalse(publication.isConnected());
 }