001/*
002 *  $RCSfile: ByReference.java,v $
003 *  $Revision: 1.1.2.2 $ $Date: 2015/01/27 03:24:04 $
004 * 
005 *  Copyright 2012-2015 Cloud Software Group, Inc. All rights reserved.
006 */
007package com.kabira.platform.annotation;
008
009import java.lang.annotation.Documented;
010import java.lang.annotation.ElementType;
011import java.lang.annotation.Inherited;
012import java.lang.annotation.Retention;
013import java.lang.annotation.RetentionPolicy;
014import java.lang.annotation.Target;
015
016
017/**
018 * Marks a field of a non-Managed object type for inclusion in a Managed class,
019 * using copy-by-reference. This allows a Managed type to safely maintain a 
020 * reference to process-local resources.
021 * <p>
022 * A &#64;ByReference-marked field can be of any Object type that is not itself
023 * a legal Managed type.
024 * Fundamental classes in the java.lang and java.util packages - meaning String,
025 * Date, and all auto-boxed types - may not be used in &#64;ByReference fields.
026 * Using an illegal type will cause an exception to be thrown at class-load time.
027 * <p>
028 * Objects stored in a &#64;ByReference field will never be transmitted between 
029 * engines or nodes. A single shared memory instance, which may 
030 * be represented in multiple VMs, will maintain independent storage for the 
031 * &#64;ByReference field on each of those VMs.
032 * <p>
033 * Exercise caution when using a process-local reference - as a result of 
034 * failover or migration, an object may be re-homed on a new VM. The
035 * &#64;ByReference fields will be null when examined on that VM.
036 * <p>
037 * There is no transaction locking provided for non-Managed Java types. 
038 * Note that locking occurs only on the Managed object, as part of
039 * accessing or updating the ByReference-marked field.
040 * <p>
041 * This annotation has no effect when used in a non-Managed class.
042 */
043@Documented
044@Inherited
045@Retention(RetentionPolicy.RUNTIME)
046@Target(ElementType.FIELD)
047public @interface ByReference
048{
049
050}