示例#1
0
        public void AfterDestroy(EntryEvent ev)
        {
            string destroyMessage;

            ICacheableKey   cKey = ev.Key;
            CacheableString cStr = cKey as CacheableString;

            destroyMessage = "Product ID " + cStr.Value + " has been destroyed";
        }
示例#2
0
        public IGFSerializable Load(Region rp, ICacheableKey key, IGFSerializable helper)
        {
            Util.BBIncrement(EventTest.EventCountersBB, "LOAD_CACHEABLE_STRING_COUNT");
            byte[] buffer = new byte[2000];
            Util.RandBytes(buffer);
            CacheableBytes value = CacheableBytes.Create(buffer);

            return(value);
        }
示例#3
0
        public void AfterInvalidate(EntryEvent ev)
        {
            string invalidateMessage;

            ICacheableKey   cKey = ev.Key;
            CacheableString cStr = cKey as CacheableString;

            invalidateMessage = "Product ID " + cStr.Value + " has been invalidated";
        }
示例#4
0
        public virtual bool WaitForValue(ICacheableKey cKey, int maxTries, int sleepMillis)
        {
            int  tries = 0;
            bool found = false;

            while ((tries++ < maxTries) && (!(found = m_region.ContainsValueForKey(cKey))))
            {
                Thread.Sleep(sleepMillis);
            }
            return(found);
        }
示例#5
0
        public bool Equals(ICacheableKey other)
        {
            BankAccount otherAccount = other as BankAccount;

            if (otherAccount != null)
            {
                return((m_customerId == otherAccount.m_customerId) &&
                       (m_accountId == otherAccount.m_accountId));
            }
            return(false);
        }
示例#6
0
        public virtual Object WaitForValueGet(ICacheableKey cKey,
                                              int maxTries, int sleepMillis)
        {
            int    tries = 0;
            Object cVal  = null;

            while ((tries++ < maxTries) && ((cVal = m_region[cKey]) != null))
            {
                Thread.Sleep(sleepMillis);
            }
            return(cVal);
        }
示例#7
0
        public void AfterCreate(EntryEvent ev)
        {
            string createMessage;

            ICacheableKey   cKey = ev.Key;
            CacheableString cStr = cKey as CacheableString;

            Product newProd = (Product)ev.NewValue;

            createMessage = string.Format("Product ID {1} has been created. " +
                                          "Product details are:{0}\tProduct Name :  {2}{0}\tProduct Number :  " +
                                          "{3}{0}\tColor :  {4}{0}\tStock Level :  {5}{0}\tReorder Point :  " +
                                          "{6}{0}\tProduct Cost :  {7}{0}\tList Price :  " +
                                          "{8}{0}\tAvailable as of :  {9}{0}\tDiscontinued as of :  {10}",
                                          Environment.NewLine, cStr.Value, newProd.name, newProd.productNumber,
                                          newProd.color, newProd.safetyLockLevel, newProd.reorderPoint,
                                          newProd.standardCost, newProd.listPrice, newProd.sellStartDate,
                                          newProd.discontinuedDate);
        }
        public bool Equals(ICacheableKey other)
        {
            if (other == null)
            {
                return(false);
            }
            var bc = other as TradeKey;

            if (bc == null)
            {
                return(false);
            }

            if (bc == this)
            {
                return(true);
            }

            if (bc.MId == MId)
            {
                return(true);
            }
            return(false);
        }
 public IGFSerializable Load(Region region, ICacheableKey key, IGFSerializable helper)
 {
     return null;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyInterest"/> class.
 /// </summary>
 /// <param name="keys">The keys.</param>
 /// <param name="policy">The policy.</param>
 /// <param name="durable">if set to <c>true</c> register durable interest.</param>
 /// <remarks>
 /// The client can register any of its interest lists and continuous queries as durable. 
 /// Durable interest remains even if the client disconnects for a period of time. 
 /// During the client’s down time, the server maintains its durable subscriptions and then, 
 /// when the client reconnects, plays them back to the client.
 /// </remarks>
 public KeyInterest(ICacheableKey[] keys, InterestResultPolicy policy, bool durable)
 {
     this.keys = keys;
     this.policy = policy;
     this.durable = durable;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyInterest"/> class.
 /// </summary>
 /// <param name="keys">The keys.</param>
 /// <param name="policy">The policy.</param>
 public KeyInterest(ICacheableKey[] keys, InterestResultPolicy policy)
     : this(keys, policy, false)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyInterest"/> class.
 /// </summary>
 /// <param name="keys">The keys.</param>
 /// <param name="durable">if set to <c>true</c> register durable interest.</param>
 /// <remarks>
 /// The client can register any of its interest lists and continuous queries as durable. 
 /// Durable interest remains even if the client disconnects for a period of time. 
 /// During the client’s down time, the server maintains its durable subscriptions and then, 
 /// when the client reconnects, plays them back to the client.
 /// </remarks>
 public KeyInterest(ICacheableKey[] keys, bool durable)
     : this(keys, InterestResultPolicy.KeysAndValues, durable)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyInterest"/> class.
 /// </summary>
 /// <param name="keys">The keys.</param>
 public KeyInterest(ICacheableKey[] keys)
     : this(keys, InterestResultPolicy.KeysAndValues, false)
 {
 }
示例#14
0
        /*
         * AfterUpdate is invoked after an entry has been updated.  It provide access to the
         * old and new values of the entry
         */
        public void AfterUpdate(EntryEvent ev)
        {
            // text string containing the 'delta' between the two objects
            string updateMessage = null;

            try
            {
                ICacheableKey   cKey = ev.Key;
                CacheableString cStr = cKey as CacheableString;

                updateMessage = "Product ID " + cStr.Value + " has been updated." +
                                Environment.NewLine;

                Product newProduct = (Product)ev.NewValue;
                Product oldProduct = (Product)ev.OldValue;

                if (oldProduct != null)
                {
                    updateMessage = updateMessage + Environment.NewLine +
                                    "\tProduct Name :  " + oldProduct.name + " ---> " +
                                    newProduct.name + Environment.NewLine +
                                    "\tProduct Number :  " + oldProduct.productNumber + " ---> " +
                                    newProduct.productNumber + Environment.NewLine +
                                    "\tColor :  " + oldProduct.color + " ---> " +
                                    newProduct.color + Environment.NewLine +
                                    "\tStock Level :  " + oldProduct.safetyLockLevel + " ---> " +
                                    newProduct.safetyLockLevel + Environment.NewLine +
                                    "\tReorder Point :  " + oldProduct.reorderPoint + " ---> " +
                                    newProduct.reorderPoint + Environment.NewLine +
                                    "\tProduct Cost :  " + oldProduct.standardCost + " ---> " +
                                    newProduct.standardCost + Environment.NewLine +
                                    "\tList Price :  " + oldProduct.listPrice + " ---> " +
                                    newProduct.listPrice + Environment.NewLine +
                                    "\tAvailable as of :  " + oldProduct.sellStartDate + " ---> " +
                                    newProduct.sellStartDate + Environment.NewLine +
                                    "\tDiscontinued as of :  " + oldProduct.discontinuedDate + " ---> " +
                                    newProduct.discontinuedDate + Environment.NewLine;

                    txtEvent.Text = updateMessage;
                }
                else
                {
                    updateMessage = "Product ID " + cStr.Value + " has been updated. " +
                                    "A prior value does not exist.  Product details are: " + Environment.NewLine + Environment.NewLine +
                                    "\tProduct Name :  " + newProduct.name + Environment.NewLine +
                                    "\tProduct Number :  " + newProduct.productNumber + Environment.NewLine +
                                    "\tColor :  " + newProduct.color + Environment.NewLine +
                                    "\tStock Level :  " + newProduct.safetyLockLevel + Environment.NewLine +
                                    "\tReorder Point :  " + newProduct.reorderPoint + Environment.NewLine +
                                    "\tProduct Cost :  " + newProduct.standardCost + Environment.NewLine +
                                    "\tList Price :  " + newProduct.listPrice + Environment.NewLine +
                                    "\tAvailable as of :  " + newProduct.sellStartDate + Environment.NewLine +
                                    "\tDiscontinued as of :  " + newProduct.discontinuedDate + Environment.NewLine;
                }
            }
            catch (Exception e)
            {
                txtEvent.Text = "AfterUpdate exception." +
                                Environment.NewLine + e.Message;
            }
        }
示例#15
0
 public virtual bool WaitForValue(ICacheableKey key)
 {
     return(WaitForValue(key, 100, 100));
 }
 public IGFSerializable Load(Region region, ICacheableKey key, IGFSerializable helper)
 {
     return(null);
 }