當前位置: 首頁>>代碼示例>>Java>>正文


Java UID類代碼示例

本文整理匯總了Java中java.rmi.server.UID的典型用法代碼示例。如果您正苦於以下問題:Java UID類的具體用法?Java UID怎麽用?Java UID使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UID類屬於java.rmi.server包,在下文中一共展示了UID類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doMessage

import java.rmi.server.UID; //導入依賴的package包/類
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out, Object payload ) throws Exception {
    System.err.println("Reading message...");

    int op = in.read();

    switch ( op ) {
    case TransportConstants.Call:
        // service incoming RMI call
        doCall(in, out, payload);
        break;

    case TransportConstants.Ping:
        // send ack for ping
        out.writeByte(TransportConstants.PingAck);
        break;

    case TransportConstants.DGCAck:
        UID u = UID.read(in);
        break;

    default:
        throw new IOException("unknown transport op " + op);
    }

    s.close();
}
 
開發者ID:hucheat,項目名稱:APacheSynapseSimplePOC,代碼行數:27,代碼來源:JRMPListener.java

示例2: getUniqueId

import java.rmi.server.UID; //導入依賴的package包/類
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuilder safeString = new StringBuilder(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
開發者ID:bragex,項目名稱:the-vigilantes,代碼行數:22,代碼來源:MysqlSavepoint.java

示例3: doMessage

import java.rmi.server.UID; //導入依賴的package包/類
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out ) throws Exception {
    System.err.println("Reading message...");

    int op = in.read();

    switch ( op ) {
    case TransportConstants.Call:
        // service incoming RMI call
        doCall(in, out);
        break;

    case TransportConstants.Ping:
        // send ack for ping
        out.writeByte(TransportConstants.PingAck);
        break;

    case TransportConstants.DGCAck:
        UID.read(in);
        break;

    default:
        throw new IOException("unknown transport op " + op);
    }

    s.close();
}
 
開發者ID:mbechler,項目名稱:marshalsec,代碼行數:27,代碼來源:RMIRefServer.java

示例4: createXid

import java.rmi.server.UID; //導入依賴的package包/類
private Xid createXid() throws IOException {
    ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(gtridOut);
    new UID().write(dataOut);

    final byte[] gtrid = gtridOut.toByteArray();

    ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
    dataOut = new DataOutputStream(bqualOut);

    new UID().write(dataOut);

    final byte[] bqual = bqualOut.toByteArray();

    Xid xid = new MysqlXid(gtrid, bqual, 3306);
    return xid;
}
 
開發者ID:KillianMeersman,項目名稱:Geometry-wars,代碼行數:18,代碼來源:XATest.java

示例5: createXid

import java.rmi.server.UID; //導入依賴的package包/類
private Xid createXid() throws IOException {
	ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
	DataOutputStream dataOut = new DataOutputStream(gtridOut);
	new UID().write(dataOut);
	
	final byte[] gtrid = gtridOut.toByteArray();
	
	ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
	dataOut = new DataOutputStream(bqualOut);
	
	new UID().write(dataOut);
	
	final byte[] bqual = bqualOut.toByteArray();
	
	Xid xid = new MysqlXid(gtrid, bqual, 3306);
	return xid;
}
 
開發者ID:hinsenchan,項目名稱:fil_project_mgmt_app_v2,代碼行數:18,代碼來源:XATest.java

示例6: getUniqueId

import java.rmi.server.UID; //導入依賴的package包/類
private static String getUniqueId() {
	// no need to re-invent the wheel here...
	String uidStr = new UID().toString();

	int uidLength = uidStr.length();

	StringBuffer safeString = new StringBuffer(uidLength+1);
	safeString.append('_');

	for (int i = 0; i < uidLength; i++) {
		char c = uidStr.charAt(i);

		if (Character.isLetter(c) || Character.isDigit(c)) {
			safeString.append(c);
		} else {
			safeString.append('_');
		}
	}

	return safeString.toString();
}
 
開發者ID:hinsenchan,項目名稱:fil_project_mgmt_app_v2,代碼行數:22,代碼來源:MysqlSavepoint.java

示例7: getRuntimeName0

import java.rmi.server.UID; //導入依賴的package包/類
private static String getRuntimeName0()
{
	String name = null;
	String address = "localhost";
	try
	{
		address = InetAddress.getLocalHost().getHostAddress();
		Class c = Class.forName("java.lang.management.ManagementFactory");
		Method m = c.getMethod("getRuntimeMXBean", new Class[0]);
		Object runtime = m.invoke(null, new Object[0]);
		c = Class.forName("java.lang.management.RuntimeMXBean");
		m = c.getMethod("getName", new Class[0]);
		name = String.valueOf(m.invoke(runtime, new Object[0]));
		name += "@" + address;
	}
	catch (Throwable ex)
	{
		name = (new UID()) + "@" + address;
	}
	return name;
}
 
開發者ID:micromagic,項目名稱:eterna,代碼行數:22,代碼來源:DataBaseLocker.java

示例8: sendDGCAck

import java.rmi.server.UID; //導入依賴的package包/類
/**
 * Opens a connection to the given Endpoint and writes DGC ack there.
 *
 * @param uid UID to be send
 */
public void sendDGCAck(UID uid) {
    ClientConnection conn = null;

    try {
        conn = ClientConnectionManager.getConnection(ep);
        DataOutputStream dout = new DataOutputStream(out);
        dout.writeByte(RMIProtocolConstants.DGCACK_MSG);
        uid.write(dout);
        dout.flush();
        conn.releaseOutputStream();
        conn.done();
    } catch (IOException ioe) {
        if (conn != null) {
            conn.close();
        }
    }

    if (dgcLog.isLoggable(RMILog.VERBOSE)) {
        // rmi.log.93=Sent DGC ack to {0} for {1}
        dgcLog.log(RMILog.VERBOSE, Messages.getString("rmi.log.93", ep, uid)); //$NON-NLS-1$
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:28,代碼來源:ClientConnection.java

示例9: defaultID

import java.rmi.server.UID; //導入依賴的package包/類
/**
 * Creates an ID from a hashcode.
 * 
 * @return an id for the feature.
 */
String defaultID() {
	// According to GML and XML schema standards, FID is a XML ID
	// (http://www.w3.org/TR/xmlschema-2/#ID), whose acceptable values are
	// those that match an
	// NCNAME production
	// (http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName):
	// NCName ::= (Letter | '_') (NCNameChar)* /* An XML Name, minus the ":"
	// */
	// NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar |
	// Extender
	// We have to fix the generated UID replacing all non word chars with an
	// _ (it seems
	// they area all ":")
	return "fid-" + new UID().toString().replaceAll("\\W", "_");
}
 
開發者ID:52North,項目名稱:uDig-SOS-plugin,代碼行數:21,代碼來源:SOSFeature.java

示例10: getUniqueId

import java.rmi.server.UID; //導入依賴的package包/類
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuffer safeString = new StringBuffer(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
開發者ID:BasThomas,項目名稱:SMPT42,代碼行數:22,代碼來源:MysqlSavepoint.java

示例11: newUidString

import java.rmi.server.UID; //導入依賴的package包/類
/**
 * @return Returns a new UID String
 */
public static String newUidString() {
    UID uid = new UID();

    byte[] val = uid.toString().getBytes();

    String suid = "";
    int v;

    for (byte aVal : val) {
        v = aVal;
        suid += Integer.toHexString(v);
    }

    return suid;
}
 
開發者ID:OPENDAP,項目名稱:olfs,代碼行數:19,代碼來源:MultipartResponse.java

示例12: newUidString

import java.rmi.server.UID; //導入依賴的package包/類
/**
 *
 * @return Returns a new UID String
 */
public static String newUidString(){
    UID uid = new UID();

    byte[] val = uid.toString().getBytes(HyraxStringEncoding.getCharset());

    StringBuilder suid  = new StringBuilder();
    int v;

    for (byte aVal : val) {
        v = aVal;
        suid.append(Integer.toHexString(v));
    }

    return suid.toString();
}
 
開發者ID:OPENDAP,項目名稱:olfs,代碼行數:20,代碼來源:MimeBoundary.java

示例13: doDgcAckWaitingMapCleanUp

import java.rmi.server.UID; //導入依賴的package包/類
/**
 * It does periodic cleanups in the {@link #dgcAckWaitingMap}, to
 * free the memory that could be still allocated due to lost dgcAcks
 */
protected void doDgcAckWaitingMapCleanUp() {
	long time = System.currentTimeMillis();
	synchronized (dgcAckWaitingMap) {
		if (time > dgcAckMapNextCleanup) {
			Iterator<Map.Entry<UID, Pair<Long, Object>>> iter = dgcAckWaitingMap
					.entrySet().iterator();
			while (iter.hasNext()) {
				Map.Entry<UID, Pair<Long, Object>> mapEntry = iter.next();
				if (time > mapEntry.getValue().getFirst()) {
					iter.remove();
				}
			}
			dgcAckMapNextCleanup = time + dgcAckMapTimeOut;
		}
	}
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:21,代碼來源:AbstractServerConnection.java


注:本文中的java.rmi.server.UID類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。