Package com.orientechnologies.orient.core.exception

Examples of com.orientechnologies.orient.core.exception.OTransactionException


           final OStorageOperationResult<ORawBuffer> previousContent = wrapped.readRecord(rid, null, false, null, false,
               LOCKING_STRATEGY.DEFAULT);

           if (previousContent.getResult() == null)
             // DELETED
             throw new OTransactionException("Cannot update record '" + rid + "' because has been deleted");

           task = new OUpdateRecordTask(rid, previousContent.getResult().getBuffer(), previousContent.getResult().version,
               record.toStream(), record.getRecordVersion());
           break;

         case ORecordOperation.DELETED:
           task = new ODeleteRecordTask(rid, record.getRecordVersion());
           break;

         default:
           continue;
         }

         involvedClusters.add(getClusterNameByRID(rid));
         txTask.add(task);
       }

       final Set<String> nodes = dbCfg.getServers(involvedClusters);

       Boolean executionModeSynch = dbCfg.isExecutionModeSynchronous(null);
       if (executionModeSynch == null)
         executionModeSynch = Boolean.TRUE;

       if (executionModeSynch && !iTx.hasRecordCreation()) {
         // SYNCHRONOUS CALL: REPLICATE IT
         final Object result = dManager.sendRequest(getName(), involvedClusters, nodes, txTask, EXECUTION_MODE.RESPONSE);
         if (result instanceof List<?>) {
           final List<Object> list = (List<Object>) result;
           for (int i = 0; i < txTask.getTasks().size(); ++i) {
             final Object o = list.get(i);

             final OAbstractRecordReplicatedTask task = txTask.getTasks().get(i);

             if (task instanceof OCreateRecordTask) {
               final OCreateRecordTask t = (OCreateRecordTask) task;
               t.getRid().copyFrom(((OPlaceholder) o).getIdentity());
               t.getVersion().copyFrom(((OPlaceholder) o).getRecordVersion());

             } else if (task instanceof OUpdateRecordTask) {
               final OUpdateRecordTask t = (OUpdateRecordTask) task;
               t.getVersion().copyFrom((ORecordVersion) o);

             } else if (task instanceof ODeleteRecordTask) {

             }

           }
         } else if (result instanceof Throwable) {
           // EXCEPTION: LOG IT AND ADD AS NESTED EXCEPTION
           if (ODistributedServerLog.isDebugEnabled())
             ODistributedServerLog.debug(this, dManager.getLocalNodeName(), null, ODistributedServerLog.DIRECTION.NONE,
                 "distributed transaction error: %s", result, result.toString());

           if (result instanceof OTransactionException || result instanceof ONeedRetryException)
             throw (RuntimeException) result;

           throw new OTransactionException("Error on committing distributed transaction", (Throwable) result);
         } else {
           // UNKNOWN RESPONSE TYPE
           if (ODistributedServerLog.isDebugEnabled())
             ODistributedServerLog.debug(this, dManager.getLocalNodeName(), null, ODistributedServerLog.DIRECTION.NONE,
                 "distributed transaction error, received unknown response type: %s", result);

           throw new OTransactionException("Error on committing distributed transaction, received unknown response type " + result);
         }

         return;
       }
View Full Code Here


        case ORecordOperation.DELETED:
          ORecordInternal.fill(entry.getRecord(), rid, channel.readVersion(), null, false);
          break;

        default:
          throw new OTransactionException("Unrecognized tx command: " + recordStatus);
        }

        // PUT IN TEMPORARY LIST TO GET FETCHED AFTER ALL FOR CACHE
        tempEntries.put(entry.getRecord().getIdentity(), entry);
      }
View Full Code Here

            } else
              key = storedKey;
          } else
            key = null;
        } catch (IOException ioe) {
          throw new OTransactionException("Error during index changes deserialization. ", ioe);
        }

        for (final ODocument op : operations) {
          final int operation = (Integer) op.rawField("o");
          final OTransactionIndexChanges.OPERATION indexOperation = OTransactionIndexChanges.OPERATION.values()[operation];
View Full Code Here

        break;
      }
    } catch (Exception e) {
      // ABORT TX COMMIT
      iNetwork.writeByte((byte) -1);
      throw new OTransactionException("Error on transaction commit", e);
    }

    iNetwork.writeByte((byte) 1);
    iNetwork.writeByte(txEntry.type);
    iNetwork.writeRID(txEntry.getRecord().getIdentity());
View Full Code Here

  protected void autoStartTransaction() {
    final boolean txBegun = database.getTransaction().isActive();

    if (!settings.autoStartTx) {
      if (settings.requireTransaction && !txBegun)
        throw new OTransactionException("Transaction required to change the Graph");

      return;
    }

    if (!txBegun)
View Full Code Here

      if (version != null)
        iRecord.getRecordVersion().copyFrom(version);
    }

    if (db.isMVCC() && !versionConfigured && db.getTransaction() instanceof OTransactionOptimistic)
      throw new OTransactionException(
          "Cannot involve an object of class '"
              + pojoClass
              + "' in an Optimistic Transaction commit because it does not define @Version or @OVersion and therefore cannot handle MVCC");

    // SET OBJECT CLASS
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.exception.OTransactionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.