public static NeoDatis.Tool.Mutex.Mutex Get(string name)
 {
     lock (typeof(MutexFactory))
     {
         NeoDatis.Tool.Mutex.Mutex mutex = mutexs[name];
         if (mutex == null)
         {
             mutex = new NeoDatis.Tool.Mutex.Mutex(name);
             mutex.SetDebug(debug);
             mutexs.Add(name, mutex);
         }
         return(mutex);
     }
 }
		public static NeoDatis.Tool.Mutex.Mutex Get(string name)
		{
			lock (typeof(MutexFactory))
			{
				NeoDatis.Tool.Mutex.Mutex mutex = mutexs[name];
				if (mutex == null)
				{
					mutex = new NeoDatis.Tool.Mutex.Mutex(name);
					mutex.SetDebug(debug);
					mutexs.Add(name, mutex);
				}
				return mutex;
			}
		}
Beispiel #3
0
 // nothing
 public override bool BeforeInsert(object @object)
 {
     if (@object.GetType() != typeof(NeoDatis.Odb.Test.Trigger.ObjectWithAutoIncrementId
                                     ))
     {
         return(false);
     }
     NeoDatis.Odb.Test.Trigger.ObjectWithAutoIncrementId o = (NeoDatis.Odb.Test.Trigger.ObjectWithAutoIncrementId
                                                              )@object;
     NeoDatis.Tool.Mutex.Mutex mutex = NeoDatis.Tool.Mutex.MutexFactory.Get("auto increment mutex"
                                                                            );
     try
     {
         try
         {
             mutex.Acquire("trigger");
             long id = GetNextId("test");
             o.SetId(id);
             // System.out.println("setting new id "+ id);
             return(true);
         }
         catch (System.Exception e)
         {
             // TODO Auto-generated catch block
             throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.InternalError
                                                        , e);
         }
     }
     finally
     {
         if (mutex != null)
         {
             mutex.Release("trigger");
         }
     }
 }