当前位置: 首页>>代码示例>>Java>>正文


Java UUIDGenerator.randomUUID方法代码示例

本文整理汇总了Java中org.apache.catalina.tribes.util.UUIDGenerator.randomUUID方法的典型用法代码示例。如果您正苦于以下问题:Java UUIDGenerator.randomUUID方法的具体用法?Java UUIDGenerator.randomUUID怎么用?Java UUIDGenerator.randomUUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.tribes.util.UUIDGenerator的用法示例。


在下文中一共展示了UUIDGenerator.randomUUID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendMessage

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws
    ChannelException {
    //todo, optimize, if destination.length==1, then we can do
    //msg.setOptions(msg.getOptions() & (~getOptionFlag())
    //and just send one message
    if (okToProcess(msg.getOptions()) ) {
        super.sendMessage(destination, msg, null);
        ChannelMessage confirmation = null;
        if ( deepclone ) confirmation = (ChannelMessage)msg.deepclone();
        else confirmation = (ChannelMessage)msg.clone();
        confirmation.getMessage().reset();
        UUIDGenerator.randomUUID(false,confirmation.getUniqueId(),0);
        confirmation.getMessage().append(START_DATA,0,START_DATA.length);
        confirmation.getMessage().append(msg.getUniqueId(),0,msg.getUniqueId().length);
        confirmation.getMessage().append(END_DATA,0,END_DATA.length);
        super.sendMessage(destination,confirmation,payload);
    } else {
        //turn off two phase commit
        //this wont work if the interceptor has 0 as a flag
        //since there is no flag to turn off
        //msg.setOptions(msg.getOptions() & (~getOptionFlag()));
        super.sendMessage(destination, msg, payload);
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:26,代码来源:TwoPhaseCommitInterceptor.java

示例2: send

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
/**
 * Send a message and wait for the response.
 * @param destination Member[] - the destination for the message, and the members you request a reply from
 * @param message Serializable - the message you are sending out
 * @param rpcOptions int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions channel sender options
 * @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, 
                       Serializable message,
                       int rpcOptions, 
                       int channelOptions,
                       long timeout) throws ChannelException {
    
    if ( destination==null || destination.length == 0 ) return new Response[0];
    
    //avoid dead lock
    int sendOptions =
        channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;
    
    RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
    RpcCollector collector = new RpcCollector(key,rpcOptions,destination.length);
    try {
        synchronized (collector) {
            if ( rpcOptions != NO_REPLY ) responseMap.put(key, collector);
            RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
            channel.send(destination, rmsg, sendOptions);
            if ( rpcOptions != NO_REPLY ) collector.wait(timeout);
        }
    } catch ( InterruptedException ix ) {
        Thread.currentThread().interrupt();
    } finally {
        responseMap.remove(key);
    }
    return collector.getResponses();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:39,代码来源:RpcChannel.java

示例3: createElectionMsg

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
private CoordinationMessage createElectionMsg(MemberImpl local, MemberImpl[] others, MemberImpl leader) {
    Membership m = new Membership(local,AbsoluteOrder.comp,true);
    Arrays.fill(m,others);
    MemberImpl[] mbrs = m.getMembers();
    m.reset(); 
    CoordinationMessage msg = new CoordinationMessage(leader, local, mbrs,new UniqueId(UUIDGenerator.randomUUID(true)), COORD_REQUEST);
    return msg;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:NonBlockingCoordinator.java

示例4: addRandomDomain

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
/**
 * Configures a set of channels to use a random domain. Use to ensure that
 * multiple instance of the test suite do not interfere when running on the
 * same machine. This may happen in a CI system or when a developer is
 * running tests for multiple branches in parallel.
 */
public static void addRandomDomain(ManagedChannel[] channels) {
    if (channels == null) {
        return;
    }

    byte[] domain = UUIDGenerator.randomUUID(false);

    for (ManagedChannel channel : channels) {
        channel.getMembershipService().setDomain(domain);
        DomainFilterInterceptor filter = new DomainFilterInterceptor();
        filter.setDomain(domain);
        channel.addInterceptor(filter);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:TesterUtil.java

示例5: send

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
/**
 * Send a message and wait for the response.
 * 
 * @param destination
 *            Member[] - the destination for the message, and the members
 *            you request a reply from
 * @param message
 *            Serializable - the message you are sending out
 * @param rpcOptions
 *            int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions
 *            channel sender options
 * @param timeout
 *            long - timeout in milliseconds, if no reply is received within
 *            this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, Serializable message, int rpcOptions, int channelOptions, long timeout)
		throws ChannelException {

	if (destination == null || destination.length == 0)
		return new Response[0];

	// avoid dead lock
	int sendOptions = channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;

	RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
	RpcCollector collector = new RpcCollector(key, rpcOptions, destination.length);
	try {
		synchronized (collector) {
			if (rpcOptions != NO_REPLY)
				responseMap.put(key, collector);
			RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
			channel.send(destination, rmsg, sendOptions);
			if (rpcOptions != NO_REPLY)
				collector.wait(timeout);
		}
	} catch (InterruptedException ix) {
		Thread.currentThread().interrupt();
	} finally {
		responseMap.remove(key);
	}
	return collector.getResponses();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:46,代码来源:RpcChannel.java

示例6: createElectionMsg

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
private CoordinationMessage createElectionMsg(MemberImpl local, MemberImpl[] others, MemberImpl leader) {
	Membership m = new Membership(local, AbsoluteOrder.comp, true);
	Arrays.fill(m, others);
	MemberImpl[] mbrs = m.getMembers();
	m.reset();
	CoordinationMessage msg = new CoordinationMessage(leader, local, mbrs,
			new UniqueId(UUIDGenerator.randomUUID(true)), COORD_REQUEST);
	return msg;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:10,代码来源:NonBlockingCoordinator.java

示例7: send

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
/**
 * Send a message and wait for the response.
 * @param destination Member[] - the destination for the message, and the members you request a reply from
 * @param message Serializable - the message you are sending out
 * @param rpcOptions int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions channel sender options
 * @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, 
                       Serializable message,
                       int rpcOptions, 
                       int channelOptions,
                       long timeout) throws ChannelException {
    
    if ( destination==null || destination.length == 0 ) return new Response[0];
    
    //avoid dead lock
    int sendOptions =
        channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;
    
    RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
    RpcCollector collector = new RpcCollector(key,rpcOptions,destination.length);
    try {
        synchronized (collector) {
            if ( rpcOptions != NO_REPLY ) responseMap.put(key, collector);
            RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
            channel.send(destination, rmsg, sendOptions);
            if ( rpcOptions != NO_REPLY ) collector.wait(timeout);
        }
    } catch ( InterruptedException ix ) {
        Thread.currentThread().interrupt();
    }finally {
        responseMap.remove(key);
    }
    return collector.getResponses();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:39,代码来源:RpcChannel.java

示例8: send

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
/**
 * Send a message and wait for the response.
 * @param destination Member[] - the destination for the message, and the members you request a reply from
 * @param message Serializable - the message you are sending out
 * @param rpcOptions int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions channel sender options
 * @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, 
                       Serializable message,
                       int rpcOptions, 
                       int channelOptions,
                       long timeout) throws ChannelException {
    
    if ( destination==null || destination.length == 0 ) return new Response[0];
    
    //avoid dead lock
    int sendOptions =
        channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;
    
    RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
    RpcCollector collector = new RpcCollector(key,rpcOptions,destination.length,timeout);
    try {
        synchronized (collector) {
            if ( rpcOptions != NO_REPLY ) responseMap.put(key, collector);
            RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
            channel.send(destination, rmsg, sendOptions);
            if ( rpcOptions != NO_REPLY ) collector.wait(timeout);
        }
    } catch ( InterruptedException ix ) {
        Thread.currentThread().interrupt();
    }finally {
        responseMap.remove(key);
    }
    return collector.getResponses();
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:39,代码来源:RpcChannel.java

示例9: generateUUID

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
/**
 * Generates a UUID and invokes setUniqueId
 */
public void generateUUID() {
    byte[] data = new byte[16];
    UUIDGenerator.randomUUID(USE_SECURE_RANDOM_FOR_UUID,data,0);
    setUniqueId(data);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:ChannelData.java

示例10: generateUUID

import org.apache.catalina.tribes.util.UUIDGenerator; //导入方法依赖的package包/类
/**
 * Generates a UUID and invokes setUniqueId
 */
public void generateUUID() {
	byte[] data = new byte[16];
	UUIDGenerator.randomUUID(USE_SECURE_RANDOM_FOR_UUID, data, 0);
	setUniqueId(data);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:9,代码来源:ChannelData.java


注:本文中的org.apache.catalina.tribes.util.UUIDGenerator.randomUUID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。