473,776 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Do you see anyone 'Remotely' of some help!!??

We have an object that is to be shared across different multi-threaded
nodes in a distributed system. It should be possible to lock that
object using any thread, and the other node which shares the object
should also know that the object is blocked.

Any ideas??!

halp!!

take care everyone,
PDA team, iiit-b, India
Jul 17 '05 #1
2 1364
Hi donny,

A simple implementation would be something like this

//############### ######
//Shared Object's probable implementation
//############### ######

class SharedClass {
public static lock;

public SharedClass() {
}
public boolean lockStatus() {
return lock;
}
public void setLock(){
lock = true;
}
public void freeLock() {
lock = false;
}
}

//############### ######
//Thread implementation
//############### ######

class MyThread extends Thread() {
public MyThread() {
}

public void run() {
if(!sharedObjec t.lockStatus) {
sharedObject.se tLock();
// do the processing here.

//unlock here
sharedObject.fr eeLock();
}
}
}

*************** *************** *************** *************

The basic flaw of this code it does not work under unsynchronized
thread enironment. so make sure you make the threads synchronize.

If your using unsynchronized threads environ then probably you must
consider your operating Systems process management and apply such a
algorithm.

All the best.
Giridhar Nandigam.

PS: Programming is an art not a methodolgy. So everything is
programmabale. Hence nothing is hard. You can do better than me.

dd*****@hotmail .com (Donny) wrote in message news:<73******* *************** ***@posting.goo gle.com>...
We have an object that is to be shared across different multi-threaded
nodes in a distributed system. It should be possible to lock that
object using any thread, and the other node which shares the object
should also know that the object is blocked.

Any ideas??!

halp!!

take care everyone,
PDA team, iiit-b, India

Jul 17 '05 #2
Hi donny,

A simple implementation would be something like this

//############### ######
//Shared Object's probable implementation
//############### ######

class SharedClass {
public static lock;

public SharedClass() {
}
public boolean lockStatus() {
return lock;
}
public void setLock(){
lock = true;
}
public void freeLock() {
lock = false;
}
}

//############### ######
//Thread implementation
//############### ######

class MyThread extends Thread() {
public MyThread() {
}

public void run() {
if(!sharedObjec t.lockStatus) {
sharedObject.se tLock();
// do the processing here.

//unlock here
sharedObject.fr eeLock();
}
}
}

*************** *************** *************** *************

The basic flaw of this code it does not work under unsynchronized
thread enironment. so make sure you make the threads synchronize.

If your using unsynchronized threads environ then probably you must
consider your operating Systems process management and apply such a
algorithm.

All the best.
Giridhar Nandigam.

PS: Programming is an art not a methodolgy. So everything is
programmabale. Hence nothing is hard. You can do better than me.

dd*****@hotmail .com (Donny) wrote in message news:<73******* *************** ***@posting.goo gle.com>...
We have an object that is to be shared across different multi-threaded
nodes in a distributed system. It should be possible to lock that
object using any thread, and the other node which shares the object
should also know that the object is blocked.

Any ideas??!

halp!!

take care everyone,
PDA team, iiit-b, India

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6328
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334, column 13: there is no attribute "SRC" <bgsound src="C:\My Documents\zingwent.mids"> You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is...
3
1591
by: Mike | last post by:
Hey guys I am pulling my hair out on this problem!!!!! Any help or ideas or comments on how to make this work I would be grateful! I have been working on this for the past 4 days and nothing I do seems to get me any closer to the solution. Below is a program that I am working on for a class project. The original code was provided for us which is what I have below. What we have to do is make the app run so that it allows the user to add...
9
2937
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with a device. The definition of the table is as follows: CREATE TABLE devicedata ( device_id int NOT NULL REFERENCES devices(id), -- id in the device
1
1154
by: Chua Wen Ching | last post by:
Hi, I am away from my office PC now, so i can't get my problem codes up. I can achieve this in C# with xmldocument and xmlelement <Device> <ExecuteProcess1 /> <ExecuteProcess2> Test
4
1648
by: Justin | last post by:
Hi, i need some help on this urgently... Thanx.... The situation is like this, i need to find out the way to convert Chinese characters into hexa code. but the problem is what i got from bin2hex() is not giving the desired output. below is the sample of what i want: input : 新聞首頁 output: 65B0805E99969801 (this is the output from some converter for non english language UCS) output: %e6%96%b0%e8%81%9e%e9%a6%96%e9%a0%81 (this is the...
19
2084
by: ash | last post by:
hi friends, i have some questions whch is in my last year question papers.i need some help to get logic of these questions. 1) write a C function, that takes two strings as arguments and returns a pointer to the first occurrence of 1st string in 2nd string or NULL if it is not present. -- i tried to solve it but it seems that i am not understanding this question at all.i am taking this question as:
1
2323
by: AlmasKhan01 | last post by:
Hi I have been for sometime now been working on a MineSweeper program and I'm 90% complete on it it involves a window interface and is quite simple but the issue is not. The program is long(to me) and includes maybe 4 classes and lots of code I was wondering if anyone would mind taking a look at it for me, I know thats a lot to ask of someone that knows nothing of me, but this problem is killing me and I have spent many hours trying to figure...
1
1175
gammyfeet
by: gammyfeet | last post by:
Hi guys, and girls, I fairly new to scripting and kind of understand it, I usualy find scripts and change them to my needs but sometimes I get stuck so it's good to find a place to find/share information! I have a problem now with a script if anyone can help that would be GREAT! I am trying to 'swap' a <div> and have found a way to do it but it does not show up in diffrent browsers at all. Safari is ok and works exactly the way I...
5
2075
by: jkyong | last post by:
I have a code here...anyone care to help me decrypt it? I really need it and i think it's in chinese or maybe not..... </span><br /> <div id="IdBSpdLq" ...
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5368
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.