Example of a connection pool (from Jive) (5)

Source: Internet
Author: User
Tags abstract final
File: Dbconnectionprovider.java

Package com.qingtuo.db.pool;

Import java.sql.*;
Import java.util.*;

Public abstract class Dbconnectionprovider {

/** Dummy values. Override in subclasses. **/
private static final String NAME = "";
private static final String DESCRIPTION = "";
private static final String AUTHOR = "";
private static final int major_version = 0;
private static final int minor_version = 0;
Private static Final Boolean pooled = false;

/**
* Returns The name of the connection provider.
*/
Public String GetName () {
return NAME;
}

/**
* Returns A description of the connection provider.
*/
Public String getdescription () {
return DESCRIPTION;
}

/**
* Returns The author of the connection provider.
*/
Public String Getauthor () {
return AUTHOR;
}

/**
* Returns The major version of the connection provider, i.e. the 1 in 1.0.
*/
public int getmajorversion () {
return major_version;
}

public int getminorversion () {

return minor_version;

}

/**
* Returns True if this is connection provider provides connections out
* of a connection pool.
*/
public Boolean ispooled () {
return pooled;
}

/**
* Returns a database connection. When a Jive component be done with a
* connection, it would call the "close" of that connection. Therefore,
* Connection pools with special release methods are not directly
* Supported by the connection provider infrastructure. Instead, connections
* From those pools should is wrapped such that calling the Close method
* On the wrapper class would release the connection from the pool.
*/
Public abstract Connection getconnection ();

/**
* Starts the connection provider. For some connection providers, this
* 'll be a no-op. However, connection provider users should always call
* This method to make sure the connection provider is started.
*/
protected abstract void start ();

/**
* This method should is called whenever properties have been changed so
* That the changes would take effect.
*/
protected abstract void restart ();

/**
* Tells the connection provider to destroy itself. For many connection
* Providers, this would essentially result in a no-op. However,
* Connection provider users should always call this method when changing
* From one connection provider to another to ensure that there are no
* Dangling database connections.
*/
protected abstract void Destroy ();

/**
* Returns The value of a property of the connection provider.
*
* @param name The name of the property.
* @returns The value of the property.
*/
Public abstract string GetProperty (string name);

/**
* Returns The description of the connection provider.
*
* @param name The name of the property.
* @return The description of the property.
*/
Public abstract String Getpropertydescription (string name);

/**
* Returns An enumeration's property names for the connection provider.
*/
Public abstract enumeration PropertyNames ();

/**
* Sets A property of the connection provider. Each provider has a set number
* of properties that are determined by the author. Trying to set a non-
* Existant property'll result in a illegalargumentexception.
*
* @param name The name of the property to set.
* @param value The new value for the property.
*/
public abstract void SetProperty (string name, string value);

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.