Codota Logo
QueryExecutorImpl.hasLock
Code IndexAdd Codota to your IDE (free)

How to use
hasLock
method
in
org.postgresql.core.v3.QueryExecutorImpl

Best Java code snippets using org.postgresql.core.v3.QueryExecutorImpl.hasLock (Showing top 20 results out of 315)

  • Common ways to obtain QueryExecutorImpl
private void myMethod () {
QueryExecutorImpl q =
  • Codota IconProtocolConnectionImpl protocolConnectionImpl;PGStream pgStream;Properties info;Logger logger;new QueryExecutorImpl(protocolConnectionImpl, pgStream, info, logger)
  • Smart code suggestions by Codota
}
origin: org.postgresql/postgresql

public boolean isActive() {
 synchronized (queryExecutor) {
  return queryExecutor.hasLock(this);
 }
}
origin: postgresql/postgresql

public boolean isActive() {
  synchronized(queryExecutor) {
    return queryExecutor.hasLock(this);
  }
}

origin: org.postgresql/postgresql

/**
 * Finishes writing to copy and unlocks connection.
 *
 * @param op the copy operation presumably currently holding lock on this connection
 * @return number of rows updated for server versions 8.2 or newer
 * @throws SQLException on failure
 */
public synchronized long endCopy(CopyOperationImpl op) throws SQLException {
 if (!hasLock(op)) {
  throw new PSQLException(GT.tr("Tried to end inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
 }
 try {
  LOGGER.log(Level.FINEST, " FE=> CopyDone");
  pgStream.sendChar('c'); // CopyDone
  pgStream.sendInteger4(4);
  pgStream.flush();
  do {
   processCopyResults(op, true);
  } while (hasLock(op));
  return op.getHandledRowCount();
 } catch (IOException ioe) {
  throw new PSQLException(GT.tr("Database connection failed when ending copy"),
    PSQLState.CONNECTION_FAILURE, ioe);
 }
}
origin: postgresql/postgresql

public synchronized void flushCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    pgStream.flush();
    processCopyResults(op, false); // collect any pending notifications without blocking
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when writing to copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: postgresql/postgresql

/**
 * Blocks to wait for a row of data to be received from server on an active copy operation
 * Connection gets unlocked by processCopyResults() at end of operation
 * @param op the copy operation presumably currently holding lock on this connection
 * @throws SQLException on any failure
 */
synchronized void readFromCopy(CopyOutImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to read from inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    processCopyResults(op, true); // expect a call to handleCopydata() to store the data
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when reading from copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.postgresql/postgresql

public synchronized void flushCopy(CopyOperationImpl op) throws SQLException {
 if (!hasLock(op)) {
  throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"),
    PSQLState.OBJECT_NOT_IN_STATE);
 }
 try {
  pgStream.flush();
  processCopyResults(op, false); // collect any pending notifications without blocking
 } catch (IOException ioe) {
  throw new PSQLException(GT.tr("Database connection failed when writing to copy"),
    PSQLState.CONNECTION_FAILURE, ioe);
 }
}
origin: org.postgresql/postgresql

/**
 * Wait for a row of data to be received from server on an active copy operation
 * Connection gets unlocked by processCopyResults() at end of operation.
 *
 * @param op the copy operation presumably currently holding lock on this connection
 * @param block whether to block waiting for input
 * @throws SQLException on any failure
 */
synchronized void readFromCopy(CopyOperationImpl op, boolean block) throws SQLException {
 if (!hasLock(op)) {
  throw new PSQLException(GT.tr("Tried to read from inactive copy"),
    PSQLState.OBJECT_NOT_IN_STATE);
 }
 try {
  processCopyResults(op, block); // expect a call to handleCopydata() to store the data
 } catch (IOException ioe) {
  throw new PSQLException(GT.tr("Database connection failed when reading from copy"),
    PSQLState.CONNECTION_FAILURE, ioe);
 }
}
origin: org.postgresql/postgresql

/**
 * Sends data during a live COPY IN operation. Only unlocks the connection if server suddenly
 * returns CommandComplete, which should not happen
 *
 * @param op the CopyIn operation presumably currently holding lock on this connection
 * @param data bytes to send
 * @param off index of first byte to send (usually 0)
 * @param siz number of bytes to send (usually data.length)
 * @throws SQLException on failure
 */
public synchronized void writeToCopy(CopyOperationImpl op, byte[] data, int off, int siz)
  throws SQLException {
 if (!hasLock(op)) {
  throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"),
    PSQLState.OBJECT_NOT_IN_STATE);
 }
 LOGGER.log(Level.FINEST, " FE=> CopyData({0})", siz);
 try {
  pgStream.sendChar('d');
  pgStream.sendInteger4(siz + 4);
  pgStream.send(data, off, siz);
  processCopyResults(op, false); // collect any pending notifications without blocking
 } catch (IOException ioe) {
  throw new PSQLException(GT.tr("Database connection failed when writing to copy"),
    PSQLState.CONNECTION_FAILURE, ioe);
 }
}
origin: org.postgresql/postgresql

if (!hasLock(op)) {
 throw new PSQLException(GT.tr("Tried to cancel an inactive copy operation"),
   PSQLState.OBJECT_NOT_IN_STATE);
   } while (hasLock(op));
  if (hasLock(op)) {
   unlock(op);
origin: org.postgresql/postgresql

if (hasLock(op)) {
 unlock(op);
origin: postgresql/postgresql

if(!hasLock(op))
  throw new PSQLException(GT.tr("Tried to cancel an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
      } while(hasLock(op));
origin: postgresql/postgresql

/**
 * Sends data during a live COPY IN operation. Only unlocks the connection if server
 * suddenly returns CommandComplete, which should not happen
 * @param op the CopyIn operation presumably currently holding lock on this connection
 * @param data bytes to send
 * @param off index of first byte to send (usually 0)
 * @param siz number of bytes to send (usually data.length)
 * @throws SQLException on failure
 */
public synchronized void writeToCopy(CopyInImpl op, byte[] data, int off, int siz) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
  if (logger.logDebug())
    logger.debug(" FE=> CopyData(" + siz + ")");
  try {
    pgStream.SendChar('d');
    pgStream.SendInteger4(siz + 4);
    pgStream.Send(data, off, siz);
    processCopyResults(op, false); // collect any pending notifications without blocking
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when writing to copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: postgresql/postgresql

/**
 * Finishes writing to copy and unlocks connection
 * @param op the copy operation presumably currently holding lock on this connection
 * @return number of rows updated for server versions 8.2 or newer
 * @throws SQLException on failure
 */
public synchronized long endCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
      throw new PSQLException(GT.tr("Tried to end inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    if (logger.logDebug())
      logger.debug(" FE=> CopyDone");
    pgStream.SendChar('c'); // CopyDone
    pgStream.SendInteger4(4);
    pgStream.flush();
    processCopyResults(op, true);
    return op.getHandledRowCount();
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when ending copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: postgresql/postgresql

if(hasLock(op))
  unlock(op);
op = null;
origin: org.ancoron.postgresql/org.postgresql

public boolean isActive() {
  synchronized(queryExecutor) {
    return queryExecutor.hasLock(this);
  }
}

origin: org.ancoron.postgresql/org.postgresql.osgi

public boolean isActive() {
  synchronized(queryExecutor) {
    return queryExecutor.hasLock(this);
  }
}

origin: org.ancoron.postgresql/org.postgresql

/**
 * Blocks to wait for a row of data to be received from server on an active copy operation
 * Connection gets unlocked by processCopyResults() at end of operation
 * @param op the copy operation presumably currently holding lock on this connection
 * @throws SQLException on any failure
 */
synchronized void readFromCopy(CopyOutImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to read from inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    processCopyResults(op, true); // expect a call to handleCopydata() to store the data
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when reading from copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql.osgi

/**
 * Blocks to wait for a row of data to be received from server on an active copy operation
 * Connection gets unlocked by processCopyResults() at end of operation
 * @param op the copy operation presumably currently holding lock on this connection
 * @throws SQLException on any failure
 */
synchronized void readFromCopy(CopyOutImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to read from inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    processCopyResults(op, true); // expect a call to handleCopydata() to store the data
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when reading from copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql

public synchronized void flushCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    pgStream.flush();
    processCopyResults(op, false); // collect any pending notifications without blocking
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when writing to copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql.osgi

public synchronized void flushCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    pgStream.flush();
    processCopyResults(op, false); // collect any pending notifications without blocking
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when writing to copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
org.postgresql.core.v3QueryExecutorImplhasLock

Popular methods of QueryExecutorImpl

  • <init>
  • cancelCopy
    Finishes a copy operation and unlocks connection discarding any exchanged data.
  • doSubprotocolBegin
  • endCopy
    Finishes writing to copy and unlocks connection.
  • flushCopy
  • initCopy
    Locks connection and calls initializer for a new CopyOperation Called via startCopy -> processCopyRe
  • interpretCommandStatus
  • lock
    Obtain lock over this connection for given object, blocking to wait if necessary.
  • processCopyResults
    Handles copy sub protocol responses from server. Unlocks at end of sub protocol, so operations on pg
  • processDeadParsedQueries
  • processDeadPortals
  • processResults
  • processDeadPortals,
  • processResults,
  • readFromCopy,
  • receiveAsyncNotify,
  • receiveCommandStatus,
  • receiveErrorResponse,
  • receiveFastpathResult,
  • receiveFields,
  • receiveNoticeResponse

Popular in Java

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • runOnUiThread (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Path (java.nio.file)
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now