mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merge from HEAD into WCM-DEV2. Also fixes build breakage in
jndi-client and catalina-virtual that I introduced earlier. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3393 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -75,6 +75,10 @@ public abstract class HostAnnouncer extends Thread
|
||||
|
||||
private byte m_updateCount;
|
||||
|
||||
// Error count
|
||||
|
||||
private int m_errorCount;
|
||||
|
||||
// Shutdown flag, host announcer should remove the announced name as it shuts down
|
||||
|
||||
private boolean m_shutdown = false;
|
||||
@@ -156,6 +160,16 @@ public abstract class HostAnnouncer extends Thread
|
||||
return m_names.numberOfStrings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the error count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected final int getErrorCount()
|
||||
{
|
||||
return m_errorCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the specified host name being announced.
|
||||
*
|
||||
@@ -493,6 +507,24 @@ public abstract class HostAnnouncer extends Thread
|
||||
m_srvtype = typ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the error count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected final int incrementErrorCount()
|
||||
{
|
||||
return ++m_errorCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the error count
|
||||
*/
|
||||
protected final void clearErrorCount()
|
||||
{
|
||||
m_errorCount = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown the host announcer and remove the announced name from Network Neighborhood.
|
||||
*/
|
||||
|
@@ -32,6 +32,10 @@ import org.alfresco.filesys.smb.server.win32.Win32NetBIOSSessionSocketHandler;
|
||||
public class Win32NetBIOSHostAnnouncer extends HostAnnouncer
|
||||
{
|
||||
|
||||
// Number of send errors before marking the LANA as offline
|
||||
|
||||
private static final int SendErrorCount = 3;
|
||||
|
||||
// Associated session handler
|
||||
|
||||
Win32NetBIOSSessionSocketHandler m_handler;
|
||||
@@ -120,6 +124,36 @@ public class Win32NetBIOSHostAnnouncer extends HostAnnouncer
|
||||
|
||||
int sts = Win32NetBIOS.SendDatagram(getLana(), getNameNumber(), destName, buf, 0, len);
|
||||
if ( sts != NetBIOS.NRC_GoodRet)
|
||||
logger.debug("Win32NetBIOS host announce error " + NetBIOS.getErrorString( -sts));
|
||||
{
|
||||
// Log the error
|
||||
|
||||
if ( logger.isErrorEnabled())
|
||||
logger.error("Host announce error " + NetBIOS.getErrorString( -sts) +
|
||||
" (LANA " + getLana() + ")");
|
||||
|
||||
// Update the error count
|
||||
|
||||
if ( incrementErrorCount() == SendErrorCount)
|
||||
{
|
||||
// Mark the LANA as offline
|
||||
|
||||
m_handler.lanaStatusChange( getLana(), false);
|
||||
|
||||
// Clear the error count
|
||||
|
||||
clearErrorCount();
|
||||
|
||||
// Log the error
|
||||
|
||||
if ( logger.isErrorEnabled())
|
||||
logger.error("Marked LANA as unavailable due to send errors");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear the error count
|
||||
|
||||
clearErrorCount();
|
||||
}
|
||||
}
|
||||
}
|
@@ -16,6 +16,8 @@
|
||||
*/
|
||||
package org.alfresco.filesys.smb.mailslot;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.alfresco.filesys.netbios.NetBIOSName;
|
||||
import org.alfresco.filesys.netbios.win32.NetBIOS;
|
||||
import org.alfresco.filesys.netbios.win32.NetBIOSSocket;
|
||||
@@ -34,6 +36,10 @@ import org.alfresco.filesys.smb.server.win32.Win32NetBIOSSessionSocketHandler;
|
||||
*/
|
||||
public class WinsockNetBIOSHostAnnouncer extends HostAnnouncer
|
||||
{
|
||||
// Number of send errors before marking the LANA as offline
|
||||
|
||||
private static final int SendErrorCount = 3;
|
||||
|
||||
// Associated session handler
|
||||
|
||||
private Win32NetBIOSSessionSocketHandler m_handler;
|
||||
@@ -116,8 +122,49 @@ public class WinsockNetBIOSHostAnnouncer extends HostAnnouncer
|
||||
|
||||
// Send the host announce datagram via the Win32 Netbios() API call
|
||||
|
||||
int sts = m_dgramSocket.sendDatagram(destNbName, buf, 0, len);
|
||||
if ( sts != len)
|
||||
logger.debug("WinsockNetBIOS host announce error");
|
||||
boolean txOK = false;
|
||||
|
||||
try
|
||||
{
|
||||
int sts = m_dgramSocket.sendDatagram(destNbName, buf, 0, len);
|
||||
if ( sts == len)
|
||||
txOK = true;
|
||||
}
|
||||
catch ( IOException ex)
|
||||
{
|
||||
// Log the error
|
||||
|
||||
if ( logger.isErrorEnabled())
|
||||
logger.error("Host announce error, " + ex.getMessage() + ", (LANA " + getLana() + ")");
|
||||
}
|
||||
|
||||
// Check if the send was successful
|
||||
|
||||
if ( txOK == false)
|
||||
{
|
||||
// Update the error count
|
||||
|
||||
if ( incrementErrorCount() == SendErrorCount)
|
||||
{
|
||||
// Mark the LANA as offline
|
||||
|
||||
m_handler.lanaStatusChange( getLana(), false);
|
||||
|
||||
// Clear the error count
|
||||
|
||||
clearErrorCount();
|
||||
|
||||
// Log the error
|
||||
|
||||
if ( logger.isErrorEnabled())
|
||||
logger.error("Marked LANA as unavailable due to send errors, (LANA " + getLana() + ")");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear the error count
|
||||
|
||||
clearErrorCount();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user