472,962 Members | 2,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,962 software developers and data experts.

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 1338
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(!sharedObject.lockStatus) {
sharedObject.setLock();
// do the processing here.

//unlock here
sharedObject.freeLock();
}
}
}

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

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.google.c om>...
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(!sharedObject.lockStatus) {
sharedObject.setLock();
// do the processing here.

//unlock here
sharedObject.freeLock();
}
}
}

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

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.google.c om>...
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
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,...
3
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...
9
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...
1
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
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()...
19
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...
1
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)...
1
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...
5
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" ...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.