当前位置: 首页>>代码示例>>Java>>正文


Java SerializableException类代码示例

本文整理汇总了Java中org.voltdb.exceptions.SerializableException的典型用法代码示例。如果您正苦于以下问题:Java SerializableException类的具体用法?Java SerializableException怎么用?Java SerializableException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SerializableException类属于org.voltdb.exceptions包,在下文中一共展示了SerializableException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
public void init(LocalTransaction ts,
                 Status status,
                 byte appStatus,
                 String appStatusString,
                 VoltTable[] results,
                 String statusString,
                 SerializableException e) {
    this.txn_id = ts.getTransactionId().longValue();
    this.clientHandle = ts.getClientHandle();
    this.basePartition = ts.getBasePartition();
    this.appStatus = appStatus;
    this.appStatusString = appStatusString;
    this.restartCounter = ts.getRestartCounter();
    this.singlepartition = ts.isPredictSinglePartition();
    this.speculative = ts.getSpeculationType();
    this.setResults(status, results, statusString, e);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:18,代码来源:ClientResponseImpl.java

示例2: testPrepareShutdownSerializeError

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
/**
 * testPrepareShutdownSerializeError
 */
@Test
public void testPrepareShutdownSerializeError() throws Exception {
    String errorMsg = "XXXXXXXXX";
    Throwable error = null;
    try {
        throw new RuntimeException(errorMsg);
    } catch (Throwable ex) {
        error = ex;
    }
    assertNotNull(error);
    SerializableException sError = new SerializableException(error);
    ByteBuffer buffer = sError.serializeToBuffer();
    buffer.rewind();
    
    ShutdownPrepareRequest.Builder builder = ShutdownPrepareRequest.newBuilder()
                                                    .setSenderSite(0)
                                                    .setError(ByteString.copyFrom(buffer));
    ShutdownPrepareRequest request = builder.build();
    
    assertTrue(request.hasError());
    buffer = request.getError().asReadOnlyByteBuffer();
    SerializableException clone = SerializableException.deserializeFromBuffer(buffer);
    assertTrue(clone.getMessage(), clone.getMessage().contains(errorMsg));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:28,代码来源:TestHStoreCoordinator.java

示例3: initFromBuffer

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
@Override
public void initFromBuffer(ByteBuffer buf) {
    m_executorHSId = buf.getLong();
    m_destinationHSId = buf.getLong();
    m_txnId = buf.getLong();
    m_spHandle = buf.getLong();
    m_status = buf.get();
    m_dirty = buf.get() == 0 ? false : true;
    m_recovering = buf.get() == 0 ? false : true;
    m_dependencyCount = buf.getShort();
    for (int i = 0; i < m_dependencyCount; i++)
        m_dependencyIds.add(buf.getInt());
    for (int i = 0; i < m_dependencyCount; i++) {
        boolean isNull = buf.get() == 0 ? true : false;
        if (isNull) {
            m_dependencies.add(null);
        } else {
            m_dependencies.add(PrivateVoltTableFactory.createVoltTableFromSharedBuffer(buf));
        }
    }
    m_exception = SerializableException.deserializeFromBuffer(buf);
    assert(buf.capacity() == buf.position());
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:24,代码来源:FragmentResponseMessage.java

示例4: shutdownPrepare

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
@Override
public void shutdownPrepare(RpcController controller, ShutdownPrepareRequest request, RpcCallback<ShutdownPrepareResponse> done) {
    String originName = HStoreThreadManager.formatSiteName(request.getSenderSite());
    
    // See if they gave us the original error. If they did, then we'll
    // try to be helpful and print it out here
    SerializableException error = null;
    if (request.hasError() && request.getError().isEmpty() == false) {
        error = SerializableException.deserializeFromBuffer(request.getError().asReadOnlyByteBuffer());
    }
    LOG.warn(String.format("Got %s from %s [hasError=%s]%s",
             request.getClass().getSimpleName(), originName, (error != null),
             (error != null ? "\n" + error : "")));
    
    // Tell the HStoreSite to prepare to shutdown
    HStoreCoordinator.this.hstore_site.prepareShutdown(request.hasError());
    
    ThreadUtil.sleep(5000);
    
    // Then send back the acknowledgment that we're good to go
    ShutdownPrepareResponse response = ShutdownPrepareResponse.newBuilder()
                                           .setSenderSite(HStoreCoordinator.this.local_site_id)
                                           .build();
    done.run(response);
    LOG.warn(String.format("Sent %s back to %s",
            response.getClass().getSimpleName(), originName));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:28,代码来源:HStoreCoordinator.java

示例5: setPendingError

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
/**
 * Set the Exception that is causing this txn to abort. It will need
 * to be processed later on.
 * This is a thread-safe operation. Only the first error will be stored.
 * @param error
 */
public synchronized void setPendingError(SerializableException error) {
    assert(error != null) : "Trying to set a null error for txn #" + this.txn_id;
    if (this.pending_error == null) {
        if (debug.val)
            LOG.warn(String.format("%s - Got %s error for txn: %s",
                     this, error.getClass().getSimpleName(), error.getMessage()));
        this.pending_error = error;
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:16,代码来源:AbstractTransaction.java

示例6: throwExceptionForError

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
/** Utility method to throw a Runtime exception based on the error code and serialized exception **/
@Override
final protected void throwExceptionForError(final int errorCode) throws RuntimeException {
    exceptionBuffer.clear();
    final int exceptionLength = exceptionBuffer.getInt();

    if (exceptionLength == 0) {
        throw new EEException(errorCode);
    } else {
        exceptionBuffer.position(0);
        exceptionBuffer.limit(4 + exceptionLength);
        throw SerializableException.deserializeFromBuffer(exceptionBuffer);
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:15,代码来源:ExecutionEngineJNI.java

示例7: getErrorResponse

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
protected ClientResponseImpl getErrorResponse(byte status, String msg, SerializableException e) {
    return new ClientResponseImpl(
            status,
            m_appStatusCode,
            m_appStatusString,
            new VoltTable[0],
            "VOLTDB ERROR: " + msg);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:9,代码来源:ProcedureRunner.java

示例8: prepareShutdownCluster

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
protected void prepareShutdownCluster(final Throwable error) throws Exception {
    final CountDownLatch latch = new CountDownLatch(this.num_sites-1);
    
    if (this.num_sites > 1) {
        RpcCallback<ShutdownPrepareResponse> callback = new ShutdownPrepareCallback(this.num_sites, latch);
        ShutdownPrepareRequest.Builder builder = ShutdownPrepareRequest.newBuilder()
                                                    .setSenderSite(this.catalog_site.getId());
        // Pack the error into a SerializableException
        if (error != null) {
            SerializableException sError = new SerializableException(error);
            ByteBuffer buffer = sError.serializeToBuffer();
            buffer.rewind();
            builder.setError(ByteString.copyFrom(buffer));
            if (debug.val)
                LOG.debug("Serializing error message in shutdown request");
        }
        ShutdownPrepareRequest request = builder.build();
        
        if (debug.val)
            LOG.debug(String.format("Sending %s to %d remote sites",
                      request.getClass().getSimpleName(), this.num_sites-1));
        for (int site_id = 0; site_id < this.num_sites; site_id++) {
            if (site_id == this.local_site_id) continue;
            
            if (this.channels[site_id] == null) {
                LOG.error(String.format("Trying to send %s to %s before the connection was established",
                          request.getClass().getSimpleName(),
                          HStoreThreadManager.formatSiteName(site_id)));
            } else {
                this.channels[site_id].shutdownPrepare(new ProtoRpcController(), request, callback);
                if (trace.val)
                    LOG.trace(String.format("Sent %s to %s",
                              request.getClass().getSimpleName(),
                              HStoreThreadManager.formatSiteName(site_id)));
            }
        } // FOR
    }
    
    // Tell ourselves to get ready
    this.hstore_site.prepareShutdown(error != null);
    
    // Block until the latch releases us
    if (this.num_sites > 1) {
        LOG.info(String.format("Waiting for %d sites to finish shutting down", latch.getCount()));
        boolean result = latch.await(10, TimeUnit.SECONDS);
        if (result == false) {
            LOG.warn("Failed to recieve all shutdown responses");
        }
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:51,代码来源:HStoreCoordinator.java

示例9: setPendingError

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
@Override
public void setPendingError(SerializableException error) {
    this.setPendingError(error, true);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:5,代码来源:LocalTransaction.java

示例10: ClientResponseImpl

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
public ClientResponseImpl(long txn_id, long client_handle, int basePartition, Status status, byte appStatus, String appStatusString, VoltTable[] results, String statusString, SerializableException e) {
    this.init(txn_id, client_handle, basePartition, status, appStatus, appStatusString, results, statusString, e);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:4,代码来源:ClientResponseImpl.java

示例11: setResults

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
private void setResults(Status status, VoltTable[] results, String extra, SerializableException e) {
    m_exception = e;
    setResults(status, results, extra);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:5,代码来源:ClientResponseImpl.java

示例12: getException

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
public SerializableException getException() {
    return m_exception;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:4,代码来源:ClientResponseImpl.java

示例13: readExternal

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
@Override
    public void readExternal(FastDeserializer in) throws IOException {
        in.readByte();//Skip version byte   // 1 byte
        this.restartCounter = in.readByte();     // 1 byte
        this.txn_id = in.readLong();             // 8 bytes
        this.clientHandle = in.readLong();       // 8 bytes
        this.singlepartition = in.readBoolean(); // 1 byte
        this.basePartition = in.readInt();       // 4 bytes
        this.speculative = SpeculationType.get(in.readByte()); // 1 byte
        this.status = Status.valueOf(in.readByte()); // 1 byte

        
        byte presentFields = in.readByte(); // 1 byte
        if ((presentFields & (1 << 5)) != 0) {
            statusString = in.readString();
        } else {
            statusString = null;
        }
        appStatus = in.readByte();
        if ((presentFields & (1 << 7)) != 0) {
            appStatusString = in.readString();
        } else {
            appStatusString = null;
        }
        clusterRoundTripTime = in.readInt();
        if ((presentFields & (1 << 6)) != 0) {
            m_exception = SerializableException.deserializeFromBuffer(in.buffer());
        } else {
            m_exception = null;
        }
        results = (VoltTable[]) in.readArray(VoltTable.class);
        setProperly = true;
        
        if (in.readBoolean()) {
            this.debug = new ClientResponseDebug();
            this.debug.readExternal(in);
        }
        
        // added by hawk, 2013/11/5
//        String[] proArr = (String[]) in.readArray(String.class);
//        for(int i=0;i<proArr.length;i++)
//            followingProcedures.add(proArr[i]);
//        if ((presentFields & (1 << 4)) != 0) {
//            m_exception = SerializableException.deserializeFromBuffer(in.buffer());
//        } else {
//            m_exception = null;
//        }
        this.initiateTime = in.readLong();
        this.batchId = in.readLong();

        // ended by hawk
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:53,代码来源:ClientResponseImpl.java

示例14: run

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
@Override
public void run() {
    rejoinLog.trace("Starting ack receiver thread");

    try {
        while (true) {
            rejoinLog.trace("Blocking on receiving mailbox");
            VoltMessage msg = m_mb.recvBlocking(10 * 60 * 1000); // Wait for 10 minutes
            if (msg == null) {
                rejoinLog.warn("No stream snapshot ack message was received in the past 10 minutes" +
                               " or the thread was interrupted (expected eofs: " + m_expectedEOFs.get() + ")" );
                continue;
            }

            // TestMidRejoinDeath ignores acks to trigger the watchdog
            if (StreamSnapshotDataTarget.m_rejoinDeathTestMode && (m_msgFactory.getAckTargetId(msg) == 1)) {
                continue;
            }

            SerializableException se = m_msgFactory.getException(msg);
            if (se != null) {
                m_lastException = se;
                rejoinLog.error("Received exception in ack receiver", se);
                return;
            }

            AckCallback ackCallback = m_callbacks.get(m_msgFactory.getAckTargetId(msg));
            if (ackCallback == null) {
                rejoinLog.error("Unknown target ID " + m_msgFactory.getAckTargetId(msg) +
                                " in stream snapshot ack message");
            } else if (m_msgFactory.getAckBlockIndex(msg) != -1) {
                ackCallback.receiveAck(m_msgFactory.getAckBlockIndex(msg));
            }

            if (m_msgFactory.isAckEOS(msg)) {
                // EOS message indicates end of stream.
                // The receiver is shared by multiple data targets, each of them will
                // send an end of stream message, must wait until all end of stream
                // messages are received before terminating the thread.
                if (m_expectedEOFs.decrementAndGet() == 0) {
                    return;
                }
            }
        }
    } catch (Exception e) {
        m_lastException = e;
        rejoinLog.error("Error reading a message from a recovery stream", e);
    } finally {
        rejoinLog.trace("Ack receiver thread exiting");
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:52,代码来源:StreamSnapshotAckReceiver.java

示例15: getException

import org.voltdb.exceptions.SerializableException; //导入依赖的package包/类
@Override
public  SerializableException getException(VoltMessage msg)
{
    return null;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:6,代码来源:StreamSnapshotBase.java


注:本文中的org.voltdb.exceptions.SerializableException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。