@Override public void visit(String str, Collection<HostAddress> collectAddresses, int[] port) { final String serverName = SharedUtils.getHostPort(str, port); collectAddresses.add(ThriftUtils.getHostAddress(serverName, port[0])); } };
final Map<TransactionAttribute, Boolean> getPendingTXFlags() { if (this.pendingTXFlags.isEmpty()) { return null; } else { final EnumMap<TransactionAttribute, Boolean> txFlags = ThriftUtils .newTransactionFlags(); for (TransactionAttribute pendingFlag : this.pendingTXFlags) { // default value sent as false in call to isTXFlagSet does not matter // since the flag is guaranteed to be set (to true or false) in any case txFlags.put(pendingFlag, this.clientService.isTXFlagSet( pendingFlag, false)); } return txFlags; } }
public byte[] getChunk() { return ThriftUtils.toBytes(chunk); }
final int parallelism = Math.max( Runtime.getRuntime().availableProcessors(), 4); if (!ThriftUtils.isThriftSelectorServer()) { final SnappyThriftServerThreadPool.Args serverArgs = new SnappyThriftServerThreadPool.Args(serverTransport);
if (propValue != null) { useSSL = true; ThriftUtils.getSSLParameters(this.socketParams, propValue);
/** * {@inheritDoc} */ @Override public void writeBinary(ByteBuffer buffer) throws TException { int length = buffer.remaining(); writeVarInt32(length); // call this in blocking transport case also to correctly deal with // case when ByteBuffer is not a heap one ThriftUtils.writeByteBuffer(buffer, trans_, nonBlockingTransport, length); }
/** * {@inheritDoc} */ @Override public ByteBuffer readDirectBinary() throws TException { if (this.useDirectBuffers && this.nonBlockingTransport != null) { int length = readVarInt32(); if (length < 0) { throw new TProtocolException(TProtocolException.NEGATIVE_SIZE, "Negative length: " + length); } return ThriftUtils.readByteBuffer(this.nonBlockingTransport, length); } else { return super.readBinary(); } }
} else { transport = new SnappyTSocket(controlAddr, null, false, true, ThriftUtils.isThriftSelectorServer(), this.socketParams);
if (propValue != null) { useSSL = true; ThriftUtils.getSSLParameters(this.socketParams, propValue);
/** * {@inheritDoc} */ @Override public void writeBinary(ByteBuffer buffer) throws TException { int length = buffer.remaining(); writeI32(length); // call this in blocking transport case also to correctly deal with // case when ByteBuffer is not a heap one ThriftUtils.writeByteBuffer(buffer, trans_, nonBlockingTransport, length); }
/** * {@inheritDoc} */ @Override public ByteBuffer readDirectBinary() throws TException { if (this.useDirectBuffers && this.nonBlockingTransport != null) { int length = readI32(); if (length < 0) { throw new TProtocolException(TProtocolException.NEGATIVE_SIZE, "Negative length: " + length); } return ThriftUtils.readByteBuffer(this.nonBlockingTransport, length); } else { return super.readBinary(); } }
&& thriftServers.remove(ThriftUtils.getHostAddress(id.getHost(), id.getPort()))) { if (thriftServers.isEmpty()) {
final EnumMap<TransactionAttribute, Boolean> getTXFlags() { final byte[] txFlags = this.txFlags; EnumMap<TransactionAttribute, Boolean> attrs = null; for (int ordinal = 0; ordinal < NUM_TXFLAGS; ordinal++) { int flag = txFlags[ordinal]; switch (flag) { case 1: case -1: if (attrs == null) { attrs = ThriftUtils.newTransactionFlags(); } TransactionAttribute attr = TransactionAttribute.findByValue(ordinal); if (attr != null) { attrs.put(attr, flag == 1); } break; default: break; } } return attrs; }
transport = new SnappyTSocket( hostAddr.resolveHost(), hostAddr.getPort(), connArgs.clientID, false, true, ThriftUtils.isThriftSelectorServer(), readTimeout, socketParams);
public BlobChunk setChunk(ByteBuffer chunk) { free(); this.chunk = chunk != null ? ByteBuffer.wrap(ThriftUtils.toBytes(chunk)) : null; return this; }
.setPassword(password).setForXA(forXA).setProperties(props); try { HostAddress hostAddr = ThriftUtils.getHostAddress(host, port); return new ClientService(hostAddr, connArgs); } catch (SnappyException se) {
.newTransactionFlags(); EnumSet<TransactionFlag> txFlags = conn.getTransactionFlags(); txAttrs.put(TransactionAttribute.AUTOCOMMIT, conn.getAutoCommit());
/** * Performs a deep copy on <i>other</i>. */ public BlobChunk(BlobChunk other) { __isset_bitfield = other.__isset_bitfield; ByteBufferReference reference = other.chunkReference; if (reference != null) { assignChunkReference(reference); } else if (other.chunk != null) { // always own the chunk if (other.chunk.isDirect()) { this.chunk = ByteBuffer.wrap(ThriftUtils.toBytes(other.chunk)); } else { this.chunk = other.chunk.duplicate(); } } this.last = other.last; this.lobId = other.lobId; this.offset = other.offset; this.totalLength = other.totalLength; }
prefHost = ThriftUtils.getHostAddress(prefServer.getHostName(), prefServer.getPort()); } else {