Search in sources :

Example 1 with GlobalReportRequest

use of io.seata.core.protocol.transaction.GlobalReportRequest in project seata by seata.

the class GlobalReportRequestCodec method encode.

@Override
public <T> void encode(T t, ByteBuf out) {
    super.encode(t, out);
    GlobalReportRequest reportRequest = (GlobalReportRequest) t;
    GlobalStatus globalStatus = reportRequest.getGlobalStatus();
    if (globalStatus != null) {
        out.writeByte((byte) globalStatus.getCode());
    } else {
        out.writeByte((byte) -1);
    }
}
Also used : GlobalReportRequest(io.seata.core.protocol.transaction.GlobalReportRequest) GlobalStatus(io.seata.core.model.GlobalStatus)

Example 2 with GlobalReportRequest

use of io.seata.core.protocol.transaction.GlobalReportRequest in project seata by seata.

the class DefaultTransactionManager method globalReport.

@Override
public GlobalStatus globalReport(String xid, GlobalStatus globalStatus) throws TransactionException {
    GlobalReportRequest globalReport = new GlobalReportRequest();
    globalReport.setXid(xid);
    globalReport.setGlobalStatus(globalStatus);
    GlobalReportResponse response = (GlobalReportResponse) syncCall(globalReport);
    return response.getGlobalStatus();
}
Also used : GlobalReportRequest(io.seata.core.protocol.transaction.GlobalReportRequest) GlobalReportResponse(io.seata.core.protocol.transaction.GlobalReportResponse)

Example 3 with GlobalReportRequest

use of io.seata.core.protocol.transaction.GlobalReportRequest in project seata by seata.

the class AbstractTCInboundHandler method handle.

@Override
public GlobalReportResponse handle(GlobalReportRequest request, final RpcContext rpcContext) {
    GlobalReportResponse response = new GlobalReportResponse();
    response.setGlobalStatus(request.getGlobalStatus());
    exceptionHandleTemplate(new AbstractCallback<GlobalReportRequest, GlobalReportResponse>() {

        @Override
        public void execute(GlobalReportRequest request, GlobalReportResponse response) throws TransactionException {
            doGlobalReport(request, response, rpcContext);
        }
    }, request, response);
    return response;
}
Also used : TransactionException(io.seata.core.exception.TransactionException) GlobalReportRequest(io.seata.core.protocol.transaction.GlobalReportRequest) GlobalReportResponse(io.seata.core.protocol.transaction.GlobalReportResponse)

Example 4 with GlobalReportRequest

use of io.seata.core.protocol.transaction.GlobalReportRequest in project seata by seata.

the class GlobalReportRequestCodec method decode.

@Override
public <T> void decode(T t, ByteBuffer in) {
    super.decode(t, in);
    GlobalReportRequest reportRequest = (GlobalReportRequest) t;
    byte b = in.get();
    if (b > -1) {
        reportRequest.setGlobalStatus(GlobalStatus.get(b));
    }
}
Also used : GlobalReportRequest(io.seata.core.protocol.transaction.GlobalReportRequest)

Example 5 with GlobalReportRequest

use of io.seata.core.protocol.transaction.GlobalReportRequest in project seata by seata.

the class GlobalReportRequestConvertor method convert2Model.

@Override
public GlobalReportRequest convert2Model(GlobalReportRequestProto globalReportRequestProto) {
    GlobalReportRequest globalReportRequest = new GlobalReportRequest();
    globalReportRequest.setExtraData(globalReportRequestProto.getAbstractGlobalEndRequest().getExtraData());
    globalReportRequest.setXid(globalReportRequestProto.getAbstractGlobalEndRequest().getXid());
    globalReportRequest.setGlobalStatus(GlobalStatus.valueOf(globalReportRequestProto.getGlobalStatus().name()));
    return globalReportRequest;
}
Also used : GlobalReportRequest(io.seata.core.protocol.transaction.GlobalReportRequest)

Aggregations

GlobalReportRequest (io.seata.core.protocol.transaction.GlobalReportRequest)5 GlobalReportResponse (io.seata.core.protocol.transaction.GlobalReportResponse)2 TransactionException (io.seata.core.exception.TransactionException)1 GlobalStatus (io.seata.core.model.GlobalStatus)1