We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,530 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Can I use a if/do loop to emulate a FIFO line for my web service?

Hey

Since I couldnt get my web service to really support multiple users, Ive thought of simply implementing a FIFO kinda of queue like this:

(The code is made up on the spot right now. Therefore, ; may be missing, some variable declared wrong, etc. Ignore that. Just concentrate on the logic)

public class somename
{

private int users;

/*Alternative:*/
// private static int users;

public void somewebservice(String somevariable)
{

if (users>0)
{
      do
            {
                  system.out.println("please wait")
            }while (users>0);
}
users=1;
system.out.println("bla");
system.out.println("bla");
system.out.println("bla");
system.out.println("bla");
/*more code here*/
//End of code:
users=0;

}



}

Would this work when multiple users call the web services at the same time to make the queue?

Thanks

1
Contributor
1
Reply
20 Hours
Discussion Span
1 Year Ago
Last Updated
2
Views
riahc3
 
Team Colleague
1,304 posts since May 2008
Reputation Points: 62
Solved Threads: 13
Skill Endorsements: 11

It works for 2 users :)

But not for 6 (3 browsers on each PC calling the web service)

riahc3
 
Team Colleague
1,304 posts since May 2008
Reputation Points: 62
Solved Threads: 13
Skill Endorsements: 11

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0901 seconds using 2.64MB