public class Connection extends java.lang.Object implements Executor, ServerProcess
Modifier and Type | Class and Description |
---|---|
static class |
Connection.Version |
Modifier and Type | Field and Description |
---|---|
static java.util.concurrent.atomic.AtomicBoolean |
DEFAULT_LOG_COMMANDS
should by default log the commands.
|
static int |
MAX_CURSOR_COUNT
The maximum number of cursors allowed per connection.
|
static java.lang.String |
THREAD_NAME_SIGNATURE
The Signature part of the thread name.
|
static double |
TOTAL_WEIGHT
The total weight of all commands allowed to be running at one time.
|
Constructor and Description |
---|
Connection(Connection rootConnection)
Constructor for a new connection from another connection
|
Connection(ForkJoinDataSource fjDS)
Constructor for a new connection from a MutableDataSource
|
Connection(Login login,
java.util.TimeZone tz)
Constructor for a new connection from a Login and timezone
|
Connection(Login login,
java.util.TimeZone tz,
boolean readonly)
Constructor for a new connection from a Login and timezone
|
Connection(MutableDataSource mds)
Constructor for a new connection from a MutableDataSource
|
Connection(Session session)
Creates a new connection using the given session to get the login and timezone
|
Modifier and Type | Method and Description |
---|---|
void |
close()
dispose of this connection.
|
void |
closeCursor(java.lang.String name)
Close this cursor and release any resources held.
|
long |
commit(java.lang.String reason)
Commit the changes to the database.
|
static Connection |
currentConnection()
The current connection for this thread.
|
org.w3c.dom.Document |
execute(java.lang.String isql)
Connection was not intended to be multiple threaded but...
|
SoapResultSet |
fetch(java.lang.String sql)
run the passed commands and return the results as a JDBC record set.
|
java.lang.Object |
getAttribute(java.lang.String code)
Returns a previously set attribute
|
DataSource |
getBestDataSource()
Try to use Readonly datasource if no modifications have been made yet.
|
java.lang.String |
getConnectionID()
get the connection id
|
Command |
getCurrentCommand()
The current command that is being processed for this connection
|
java.lang.String |
getCurrentSql()
The currently running statement.
|
SQLCommand |
getCursor(java.lang.String name)
Gets the previously executed command from the unique name passed.
|
int |
getCursorSize()
get the cursor size
|
Login |
getLogin()
The login of this connection.
|
MutableDataSource |
getMutableDataSource()
Return the current mutable data source for this connection
|
java.lang.String |
getProgressMsg()
get the progress message
|
ReadOnlyDataSource |
getReadOnlyDataSource()
Get the current read only datasource for this connection
|
Session |
getSession()
get the session if any.
|
java.lang.String |
getStateID()
return the state ID
|
java.util.TimeZone |
getTimeZone()
The timezone of this executor
|
java.lang.String |
getUserName()
get the user name
|
Connection.Version |
getVersion() |
boolean |
isCursorDisabled()
Is the cursor feature turned off ?
|
boolean |
isRowCountRequired()
Do records sets require the ROW_COUNT option
|
boolean |
isStateless()
is the connection currently stateless.
|
Command |
makeCommand(DBCommand bc)
make a command for this DBCommand
|
java.lang.String |
makeCursor(SQLCommand sql)
Make a unique cursor id for this statement
|
java.lang.String |
makeThreadName()
Create and Returns the thread name
|
void |
paused()
This process has been paused.
|
void |
resumed()
This process has been started.
|
void |
rollback()
abort any changes not committed for this connection.
|
void |
setAttribute(java.lang.String code,
java.lang.Object data)
Sets a attribute for this connection
|
void |
setCursorDisable(boolean flag)
turn on/off the cursor feature.
|
void |
setCursorSize(int cursorSize)
set the cursor size
|
void |
setReadOnlyDataSource(ReadOnlyDataSource rds)
set the readonly data source to use.
|
void |
setRowCountRequired(boolean flag)
Require the ROW_COUNT= for record sets.
|
void |
setThreadName(java.lang.String title)
Sets the connection's thread name
|
void |
setVersion(Connection.Version version)
Set the required version
|
void |
terminated()
This process has been terminated.
|
static int |
zombieCount(java.lang.String code)
Gets the zombie count for the given dbcommand code
|
static int |
zombieWeight()
Gets the zombie weight
|
public static final int MAX_CURSOR_COUNT
public static final java.util.concurrent.atomic.AtomicBoolean DEFAULT_LOG_COMMANDS
public static final java.lang.String THREAD_NAME_SIGNATURE
public static final double TOTAL_WEIGHT
public Connection(@Nonnull MutableDataSource mds) throws java.lang.Exception
mds
- The user's datasourcejava.lang.Exception
- A serious problempublic Connection(@Nonnull ForkJoinDataSource fjDS) throws java.lang.Exception
fjDS
- The fork join datasourcejava.lang.Exception
- A serious problempublic Connection(@Nonnull Login login, @Nonnull java.util.TimeZone tz) throws java.lang.Exception
login
- The Logintz
- The timezone to usejava.lang.Exception
- A serious problempublic Connection(@Nonnull Login login, @Nonnull java.util.TimeZone tz, boolean readonly) throws java.lang.Exception
login
- The Logintz
- The timezone to usereadonly
- java.lang.Exception
- A serious problempublic Connection(@Nonnull Session session) throws java.lang.Exception
session
- the session for this connectionjava.lang.Exception
- a serious problempublic Connection(@Nonnull Connection rootConnection) throws java.lang.Exception
rootConnection
- the other connectionjava.lang.Exception
- A serious problempublic void setVersion(Connection.Version version)
version
- the version@CheckReturnValue @Nonnull public Connection.Version getVersion()
@CheckReturnValue @Nullable public Session getSession()
public void setRowCountRequired(boolean flag)
flag
- Does the client require a row count ?@CheckReturnValue public boolean isRowCountRequired()
@CheckReturnValue @Nonnull public MutableDataSource getMutableDataSource()
@CheckReturnValue @Nonnull public java.lang.String getCurrentSql()
@CheckReturnValue @Nonnull public Login getLogin()
@CheckReturnValue @Nonnull public java.lang.String getUserName()
getUserName
in interface Executor
@CheckReturnValue @Nonnull public java.lang.String getConnectionID()
@CheckReturnValue public boolean isStateless()
isStateless
in interface Executor
@CheckReturnValue @Nullable public java.lang.String getStateID()
@CheckReturnValue @Nullable public java.lang.Object getAttribute(java.lang.String code)
code
- The code for the attribute to be fetchedpublic void setAttribute(java.lang.String code, java.lang.Object data)
code
- The codedata
- The data@CheckReturnValue @Nonnull public DataSource getBestDataSource()
@CheckReturnValue @Nonnull public ReadOnlyDataSource getReadOnlyDataSource()
@CheckReturnValue @Nonnull public java.lang.String makeCursor(@Nonnull SQLCommand sql) throws java.lang.Exception
sql
- The commandjava.lang.Exception
- A serious problempublic void closeCursor(@Nonnull java.lang.String name) throws java.lang.Exception
name
- The cursor namejava.lang.Exception
- A serious problem@CheckReturnValue @Nullable public static Connection currentConnection()
@CheckReturnValue @Nullable public SQLCommand getCursor(@Nonnull java.lang.String name)
name
- The cursor name@CheckReturnValue @Nonnull public SoapResultSet fetch(@Nonnull java.lang.String sql) throws java.lang.Exception
@CheckReturnValue public org.w3c.dom.Document execute(@Nonnull java.lang.String isql) throws java.lang.Exception
@CheckReturnValue public static int zombieCount(@Nonnull java.lang.String code) throws java.lang.Exception
code
- the dbcommand codejava.lang.Exception
- a serious problem@CheckReturnValue public static int zombieWeight() throws java.lang.Exception
java.lang.Exception
- a serious problempublic void setThreadName(@Nonnull java.lang.String title)
title
- The title of this connectionpublic void setReadOnlyDataSource(ReadOnlyDataSource rds)
rds
- the data sourcepublic void rollback()
public void close()
public long commit(@Nonnull java.lang.String reason) throws java.lang.Exception
reason
- The reason to be recorded in the transaction tablesjava.lang.Exception
- A problem occurred@CheckReturnValue @Nonnull public Command getCurrentCommand()
@CheckReturnValue @Nonnull public Command makeCommand(@Nonnull DBCommand bc) throws java.lang.Exception
bc
- The database commandjava.lang.Exception
- A serious problempublic void setCursorDisable(boolean flag)
flag
- TRUE will disable cursors@CheckReturnValue public boolean isCursorDisabled()
public void setCursorSize(int cursorSize)
cursorSize
- the size@CheckReturnValue public int getCursorSize()
public void paused()
paused
in interface ServerProcess
public void resumed()
resumed
in interface ServerProcess
public void terminated()
terminated
in interface ServerProcess
@CheckReturnValue @Nonnull public java.lang.String getProgressMsg()
public java.lang.String makeThreadName()
makeThreadName
in interface ServerProcess
ServerProcess.makeThreadName()
@CheckReturnValue @Nonnull public java.util.TimeZone getTimeZone()
Executor
getTimeZone
in interface Executor
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.