org.apache.lucene.store.jdbc.index
Class FetchPerTransactionJdbcIndexInput

java.lang.Object
  extended by org.apache.lucene.store.IndexInput
      extended by org.apache.lucene.store.ConfigurableBufferedIndexInput
          extended by org.apache.lucene.store.jdbc.index.JdbcBufferedIndexInput
              extended by org.apache.lucene.store.jdbc.index.FetchPerTransactionJdbcIndexInput
All Implemented Interfaces:
Cloneable, JdbcIndexConfigurable

public class FetchPerTransactionJdbcIndexInput
extends JdbcBufferedIndexInput

Caches blobs per transaction. Only supported for dialects that supports blobs per transaction (see Dialect.supportTransactionalScopedBlobs().

Note, using this index input requires calling the releaseBlobs(java.sql.Connection) when the transaction ends. It is automatically taken care of if using TransactionAwareDataSourceProxy. If using JTA for example, a transcation synchronization should be registered with JTA to clear the blobs.

Author:
kimchy

Field Summary
 
Fields inherited from class org.apache.lucene.store.jdbc.index.JdbcBufferedIndexInput
BUFFER_SIZE_SETTING
 
Fields inherited from class org.apache.lucene.store.ConfigurableBufferedIndexInput
buffer, BUFFER_SIZE, bufferLength, bufferPosition, bufferSize, bufferStart
 
Constructor Summary
FetchPerTransactionJdbcIndexInput()
           
 
Method Summary
 void close()
           
 void configure(String name, JdbcDirectory jdbcDirectory, JdbcFileEntrySettings settings)
          Configures the newly created IndexInput or IndexOutput implementations.
 long length()
           
protected  void readInternal(byte[] b, int offset, int length)
          Expert: implements buffer refill.
protected  void refill()
           
static void releaseBlobs(Connection connection)
           
static void releaseBlobs(Connection connection, JdbcTable table, String name)
           
protected  void seekInternal(long pos)
          Expert: implements seek.
 
Methods inherited from class org.apache.lucene.store.ConfigurableBufferedIndexInput
clone, getBufferSize, getFilePointer, readByte, readBytes, seek, setBufferSize
 
Methods inherited from class org.apache.lucene.store.IndexInput
readBytes, readChars, readInt, readLong, readString, readVInt, readVLong, setModifiedUTF8StringsMode, skipChars
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FetchPerTransactionJdbcIndexInput

public FetchPerTransactionJdbcIndexInput()
Method Detail

releaseBlobs

public static void releaseBlobs(Connection connection)

releaseBlobs

public static void releaseBlobs(Connection connection,
                                JdbcTable table,
                                String name)

configure

public void configure(String name,
                      JdbcDirectory jdbcDirectory,
                      JdbcFileEntrySettings settings)
               throws IOException
Description copied from interface: JdbcIndexConfigurable
Configures the newly created IndexInput or IndexOutput implementations.

Specified by:
configure in interface JdbcIndexConfigurable
Overrides:
configure in class JdbcBufferedIndexInput
Parameters:
name - The name of the file entry
jdbcDirectory - The jdbc directory instance
settings - The relevant file entry settings
Throws:
IOException

refill

protected void refill()
               throws IOException
Overrides:
refill in class ConfigurableBufferedIndexInput
Throws:
IOException

readInternal

protected void readInternal(byte[] b,
                            int offset,
                            int length)
                     throws IOException
Description copied from class: ConfigurableBufferedIndexInput
Expert: implements buffer refill. Reads bytes from the current position in the input.

Specified by:
readInternal in class ConfigurableBufferedIndexInput
Parameters:
b - the array to read bytes into
offset - the offset in the array to start storing bytes
length - the number of bytes to read
Throws:
IOException

seekInternal

protected void seekInternal(long pos)
                     throws IOException
Description copied from class: ConfigurableBufferedIndexInput
Expert: implements seek. Sets current position in this file, where the next ConfigurableBufferedIndexInput.readInternal(byte[],int,int) will occur.

Specified by:
seekInternal in class ConfigurableBufferedIndexInput
Throws:
IOException
See Also:
ConfigurableBufferedIndexInput.readInternal(byte[],int,int)

close

public void close()
           throws IOException
Specified by:
close in class IndexInput
Throws:
IOException

length

public long length()
Specified by:
length in class IndexInput


Copyright (c) 2004-2009 The Compass Project.