freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: blenkush AT ccs.neu.edu
- To: freetds AT franklin.oit.unc.edu
- Subject: JDBC code
- Date: Sun, 4 Mar 2001 01:27:08 -0500
Hi,
Im using the freetds_jdbc driver and when I do certain queries I will get
into what seems to be an infinite loop. Im a bit rusting using threads so
maybe im missing something but here is the relevant code.
//In TdsComm.java
public synchronized void startPacket(int type)
{
// Only one thread at a time can be building an outboudn packet.
// This is primarily a concern with building cancel packets.
while(someThreadIsBuildingPacket())
{
try
{
wait();
}
catch (java.lang.InterruptedException e)
{
// nop
}
}
packetType = type;
nextOutBufferIndex = headerLength;
}
/**
* Is some thread currently building a logical TDS packet?
*
* @return true iff a packet is being built.
*/
public boolean someThreadIsBuildingPacket()
{
return packetType!=0;
}
I only have one thread running. And the packetType for that thread is 1.
So packetType != 0 is 1 !=0 which is true. So in the startPacket() method
its just going to loop forever. Am I missing something stupid here or is
somehing wrong with the code?
Thanks,
Eric
- JDBC code, blenkush, 03/04/2001
Archive powered by MHonArc 2.6.24.