120 lines
6.8 KiB
HTML
120 lines
6.8 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="reference" />
|
||
|
<meta name="DC.Title" content="ClusteredHashTable classes" />
|
||
|
<meta name="abstract" content="The ClusteredHashTable classes enable your Java programs to use highly available clustered hash tables to share and replicate data to nonpersistent storage among the nodes in a cluster." />
|
||
|
<meta name="description" content="The ClusteredHashTable classes enable your Java programs to use highly available clustered hash tables to share and replicate data to nonpersistent storage among the nodes in a cluster." />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="clusteredhshtbl" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>ClusteredHashTable classes</title>
|
||
|
</head>
|
||
|
<body id="clusteredhshtbl"><a name="clusteredhshtbl"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">ClusteredHashTable classes</h1>
|
||
|
<div><p>The ClusteredHashTable classes enable your Java™ programs
|
||
|
to use highly available clustered hash tables to share and replicate data
|
||
|
to nonpersistent storage among the nodes in a cluster. </p>
|
||
|
<div class="section"><p>To use the ClusteredHashTable classes, ensure that you can use
|
||
|
nonpersistent storage for the data. Replicated data is not encrypted.</p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> The
|
||
|
following information assumes that you understand the concepts and terminology
|
||
|
common to iSeries™ clustering.
|
||
|
For more information about clusters and how to use them, see <a href="../rzaig/rzaigicclust.htm">Clusters</a>.</div>
|
||
|
<p>Using
|
||
|
the ClusteredHashTable class requires that you have defined and activated
|
||
|
a cluster on the iSeries systems. You must also start a clustered
|
||
|
has table server. For more information, see <a href="../rzaig/rzaigconfigure.htm">Configure clusters</a> and <a href="../apis/clust4a1TOC.htm">Clustered Hash Table APIs</a>.</p>
|
||
|
<p>Required parameters
|
||
|
are the name of the clustered hash table server and the AS400 object, which
|
||
|
represents the system that contains the clustered hash table server.</p>
|
||
|
<p>In
|
||
|
order to store data in a clustered hash table server, you need a connection
|
||
|
handle and a key:</p>
|
||
|
<ul><li> When you open a connection, the clustered hash table server assigns the
|
||
|
connection handle that you must specify on subsequent requests to the clustered
|
||
|
hash table server. This connection handle is good only for the instantiated
|
||
|
AS400 object, so you must open another connection if you use a different
|
||
|
AS400 object.</li>
|
||
|
<li>You must specify the key to access and change data in the clustered hash
|
||
|
table. Duplicate keys are not supported.</li>
|
||
|
</ul>
|
||
|
<p>The <a href="javadoc/com/ibm/as400/access/ClusteredHashTable.html">ClusteredHashTable</a> class provides methods that enable
|
||
|
you to perform the following actions:</p>
|
||
|
<ul><li><a href="javadoc/com/ibm/as400/access/ClusteredHashTable.html#OPEN()">Open a connection</a> to the clustered hash table server
|
||
|
job</li>
|
||
|
<li><a href="javadoc/com/ibm/as400/access/ClusteredHashTable.html#GENERATEKEY()">Generate a unique key</a> to store data into the clustered
|
||
|
hash table</li>
|
||
|
<li><a href="javadoc/com/ibm/as400/access/ClusteredHashTable.html#CLOSE()">Close the active connection</a> to the clustered hash table
|
||
|
server job</li>
|
||
|
</ul>
|
||
|
<p>Some methods in the ClusteredHashTable class use the <a href="javadoc/com/ibm/as400/access/ClusteredHashTableEntry.html">ClusteredHashTableEntry</a>
|
||
|
class to perform the following actions:</p>
|
||
|
<ul><li><a href="javadoc/com/ibm/as400/access/ClusteredHashTable.html#GET(BYTE[])">Get an entry</a> from the clustered hash table</li>
|
||
|
<li><a href="javadoc/com/ibm/as400/access/ClusteredHashTable.html#PUT(COM.IBM.AS400.ACCESS.CLUSTEREDHASHTABLEENTRY)">Store an entry</a> in the clustered hash table</li>
|
||
|
<li><a href="javadoc/com/ibm/as400/access/ClusteredHashTable.html#ELEMENTS()">Get a list of entries</a> from the clustered hash table for
|
||
|
all user profiles</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="section" id="clusteredhshtbl__useclhashtbl"><a name="clusteredhshtbl__useclhashtbl"><!-- --></a><h4 class="sectiontitle">Example: Using ClusteredHashTable</h4><p>The
|
||
|
following example operates on clustered hash table server named CHTSVR01.
|
||
|
It assumes a cluster and a clustered hash table server is already active.
|
||
|
It opens a connection, generates a key, puts an entry using the new key in
|
||
|
the clustered hash table, gets an entry from the clustered hash table, and
|
||
|
closes the connection.</p>
|
||
|
<pre> ClusteredHashTableEntry myEntry = null;
|
||
|
|
||
|
String myData = new String("This is my data.");
|
||
|
System.out.println("Data to be stored: " + myData);
|
||
|
|
||
|
AS400 system = new AS400();
|
||
|
|
||
|
ClusteredHashTable cht = new ClusteredHashTable(system,"CHTSVR01");
|
||
|
|
||
|
// Open a connection.
|
||
|
cht.open();
|
||
|
|
||
|
// Get a key to the hash table.
|
||
|
byte[] key = null;
|
||
|
key = cht.generateKey();
|
||
|
|
||
|
// Prepare some data that you want to store into the hash table.
|
||
|
// ENTRY_AUTHORITY_ANY_USER means that any user can access the
|
||
|
// entry in the clustered hash table.
|
||
|
// DUPLICATE_KEY_FAIL means that if the specified key already exists,
|
||
|
// the ClusteredHashTable.put() request will not succeed.
|
||
|
int timeToLive = 500;
|
||
|
myEntry = new ClusteredHashTableEntry(key,myData.getBytes(),timeToLive,
|
||
|
ClusteredHashTableEntry.ENTRY_AUTHORITY_ANY_USER,
|
||
|
ClusteredHashTableEntry.DUPLICATE_KEY_FAIL);
|
||
|
|
||
|
// Store (or put) the entry into the hash table.
|
||
|
cht.put(myEntry);
|
||
|
|
||
|
// Get an entry from the hash table.
|
||
|
ClusteredHashTableEntry output = cht.get(key);
|
||
|
|
||
|
// Close the connection.
|
||
|
cht.close();</pre>
|
||
|
<p>Using the ClusteredHashTable class causes
|
||
|
the AS400 object to connect to the server. For more information, see <a href="mngcon.htm#mngcon">Managing connections</a>. </p>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</body>
|
||
|
</html>
|