本文整理匯總了Java中org.apache.thrift.transport.TTransport.isOpen方法的典型用法代碼示例。如果您正苦於以下問題:Java TTransport.isOpen方法的具體用法?Java TTransport.isOpen怎麽用?Java TTransport.isOpen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.thrift.transport.TTransport
的用法示例。
在下文中一共展示了TTransport.isOpen方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: requestTransport
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
protected TProtocol requestTransport(String url) throws TTransportException {
// probably not thread safe, but we need it? Not atm.
TTransport act;
if (!activeTransports.containsKey(url)) {
logger.log(Level.DEBUG ,"Creating new transport for: " + url);
activeTransports.put(url, new THttpClient(url));
}
act = activeTransports.get(url);
if (!act.isOpen()) {
act.open();
}
// THINK: always create new protocol?
return new TJSONProtocol(act);
}
示例2: onRemoval
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
@Override
public void onRemoval(RemovalNotification<DeviceId, Pair<TTransport, Bmv2DeviceThriftClient>> notification) {
// close the transport connection
Bmv2DeviceThriftClient client = notification.getValue().getRight();
TTransport transport = notification.getValue().getLeft();
// Locking here is ugly, but needed (see SafeThriftClient).
synchronized (transport) {
if (transport.isOpen()) {
transport.close();
}
}
}
示例3: isOpen
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
@Override
public boolean isOpen() {
for (TTransport transport : transports) {
if (!transport.isOpen()) {
return false;
}
}
return true;
}
示例4: validateObject
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
@Override
public boolean validateObject(TServiceClient client) {
TTransport pin = client.getInputProtocol().getTransport();
logger.info("validateObject input:{}", pin.isOpen());
TTransport pout = client.getOutputProtocol().getTransport();
logger.info("validateObject output:{}", pout.isOpen());
return pin.isOpen() && pout.isOpen();
}
示例5: open
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
private void open( TProtocol protocol ) throws TTransportException {
if ( protocol != null ) {
TTransport transport = protocol.getTransport();
if ( transport != null && ! transport.isOpen() ) {
transport.open();
}
}
}
示例6: close
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
private void close( TProtocol protocol ) {
if ( protocol != null ) {
TTransport transport = protocol.getTransport();
if ( transport != null && transport.isOpen() ) {
transport.close();
}
}
}
示例7: destroyObject
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
@Override
public void destroyObject(ThriftServerInfo info, PooledObject<TTransport> p)
throws Exception {
TTransport transport = p.getObject();
if (transport != null && transport.isOpen()) {
transport.close();
logger.trace("close thrift connection:{}", info);
}
}
示例8: get
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
@Override
public String get(String arg) throws STException {
TTransport transport = oprot_.getTransport();
try {
if (!transport.isOpen())
transport.open();
LOG.debug("Transport is open .");
sendGet(arg);
return recvGet();
} catch (TException e) {
transport.close();
LOG.debug("Transport is close .");
throw new STException("Execute failed !", e);
}
}
示例9: destroy
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
public void destroy() throws NaviSystemException {
TTransport transport = client.getInputProtocol().getTransport();
if (transport != null && transport.isOpen()) {
transport.close();
log.info("scribe client is closed successfully!");
}
client = null;
}
示例10: destroyObject
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
@Override
public void destroyObject(PooledObject<TTransport> p) throws Exception {
try {
TTransport transport = p.getObject();
if (transport.isOpen()) {
transport.close();
}
} catch (Exception e) {
LOGGER.error("destroy transport object fail.maybe exist memory leek.e:", e);
throw new OureaException("destroy transport object fail" + e.getMessage());
}
}
示例11: isAlive
import org.apache.thrift.transport.TTransport; //導入方法依賴的package包/類
public boolean isAlive() throws NaviSystemException {
TTransport transport = client.getInputProtocol().getTransport();
return transport.isOpen();
}