public static void tryClaim(Publication publication,BufferFiller fillBuffer,int length,int timeout,TimeUnit timeUnit){
  if (publication.isClosed()) {
    throw new NotConnectedException();
  }
  final BufferClaim bufferClaim=bufferClaims.get();
  final long start=System.nanoTime();
  do {
    final long current=System.nanoTime();
    if ((current - start) > timeUnit.toNanos(timeout)) {
      throw new TimedOutException();
    }
    final long offer=publication.tryClaim(length,bufferClaim);
    if (offer >= 0) {
      try {
        final MutableDirectBuffer buffer=bufferClaim.buffer();
        final int offset=bufferClaim.offset();
        fillBuffer.fill(offset,buffer);
        break;
      }
  finally {
        bufferClaim.commit();
      }
    }
 else     if (Publication.NOT_CONNECTED == offer) {
      throw new NotConnectedException();
    }
  }
 while (true);
}

public static void tryClaim ( Publication publication , BufferFiller fillBuffer , int length , int timeout , TimeUnit timeUnit ) { if ( publication . isClosed ( ) ) { throw new NotConnectedException ( ) ; } final BufferClaim bufferClaim = bufferClaims . get ( ) ; final long start = System . nanoTime ( ) ; do { final long current = System . nanoTime ( ) ; if ( ( current - start ) > timeUnit . toNanos ( timeout ) ) { throw new TimedOutException ( ) ; } final long offer = publication . tryClaim ( length , bufferClaim ) ; if ( offer >= 0 ) { try { final MutableDirectBuffer buffer = bufferClaim . buffer ( ) ; final int offset = bufferClaim . offset ( ) ; fillBuffer . fill ( offset , buffer ) ; break ; } finally { bufferClaim . commit ( ) ; } } else if ( Publication . NOT_CONNECTED == offer ) { throw new NotConnectedException ( ) ; } } while ( true ) ; }
sends a message using tryclaim . this method will spin - lock if aeron signals back pressure . the message being sent needs to be equal or smaller than aeron ' s mtu size or an exception will be thrown . < p > in order to use this method of sending data you need to know the length of data .
