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


Java VM.shallowCopy方法代码示例

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


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

示例1:

import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
 * The copy() method is similar to Object.clone() in j2se, but the original envelope is 
 * "owned" by the sending isolate, and the copy will be "owned" by the receiving isolate.
 * 
 * The default Envelope.copy() method creates a new envelope of the actual type of
 * "this", and performs a shallow copy of the entire envelope. 
 * 
 * Note that all subclasses must be certain that the copy does not contain any direct pointers to objects 
 * from the sender's Isolate
 *
 * The copy() method itself should be careful not to store pointers to either the original or copied
 * object in static variables or any in other data structure. It's not defined which isolate will 
 * execute the copy() method.
 *
 * Called by the system once per Envelope, sometime between when the message is sent by send(),
 * and when it is received by receive().
 *
 * @return a copy of this Envelope
 */
/* package-private*/ Envelope copy() {
    // note that this does NOT call a contructor - and neither does Object.clone() as far as I can tell.
    Envelope newEnv = (Envelope)VM.shallowCopy(this);
    return newEnv;
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:25,代码来源:Envelope.java


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