Лимит ошибок связи 10
This commit is contained in:
2024-04-08 01:30:46 +03:00
parent 09afe82704
commit 4e503d3b9b
8 changed files with 56 additions and 24 deletions

10
.idea/workspace.xml generated
View File

@@ -6,7 +6,15 @@
</artifacts-to-build>
</component>
<component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="" />
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TasksPackageState.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TasksPackageState.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPackage/TestingPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPackage/TestingPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestsDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestsDatabase.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/UserConnection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/UserConnection.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />

View File

@@ -10,7 +10,7 @@
"SMTPHost": "smtp.mail.ru",
"SMTPPort": 465,
"MailSocketPort": 465,
"collapseCredentials": true,
"collapseCredentials": false,
"collapseFileGraphs": false,
"collapseFileMessages": false,
"collapseProjectTrees": false,

View File

@@ -62,7 +62,7 @@ public class Visualiser extends Component {
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
@Override
public void GetVersionInfo() {
version = 1091;
version = 1092;
String pattern = "MMM dd yyyy HH:mm:ss";
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
date_text = df.format(getClassBuildTime());

View File

@@ -28,12 +28,15 @@ public enum TasksPackageState implements StatusEnum {
Analysis,
//-
Done,
Aborted;
Aborted,
ConnectionError
;
public boolean isActive() {
switch (this) {
case Done:
case Aborted:
case Draft:
case ConnectionError:
return false;
default:
return true;
@@ -88,6 +91,8 @@ public enum TasksPackageState implements StatusEnum {
return "анализ результатов";
case Done:
return "завершен";
case ConnectionError:
return "Сбой связи";
default:
return StatusEnum.super.getDescription();
}

View File

@@ -20,6 +20,8 @@ public abstract class TestingPackage<J> extends riDBObject {
public int progress = 0; //прогресс выполнения
public long StartDate = 0;
public long ChangeDate = 0;
@Description("DEFAULT 0")
public int connectionErrosCount = 0;
public TasksPackageState state = TasksPackageState.Draft;
//--
@Override
@@ -36,6 +38,7 @@ public abstract class TestingPackage<J> extends riDBObject {
progress = tp.progress;
StartDate = tp.StartDate;
ChangeDate = tp.ChangeDate;
connectionErrosCount = tp.connectionErrosCount;
state = tp.state;
}
public TestingPackage(TestingPackage p) {

View File

@@ -137,6 +137,11 @@ public abstract class TestingPlanner<P extends TestingPackage> {
testingPackage = (P) package_in;
//--
Print(testingPackage.id + ":" + testingPackage.state.getDescription());
//--
if (testingPackage.connectionErrosCount>=10){
Print(testingPackage.id+" had 10 connection errors. stop");
UpdatePackageState(TasksPackageState.ConnectionError);
}else {
//--
InitSessionCredentials();
if (testingPackage.state.equals(TasksPackageState.Analysis)) {
@@ -154,14 +159,21 @@ public abstract class TestingPlanner<P extends TestingPackage> {
} else {
Session();
}
} else {
testingPackage.connectionErrosCount++;
UpdatePackage();
}
} catch (Exception ex) {
Print("Ошибка сеанса. Соединение будет разорвано.");
Print(ex.getMessage());
Disconnect();
//
testingPackage.connectionErrosCount++;
UpdatePackage();
} finally {
}
}
}
//--
testingPackage.destructor();
testingPackage = null;

View File

@@ -77,6 +77,7 @@ public class TestsDatabase extends SQLiteDatabase {
case Done:
case Aborted:
case Draft:
case ConnectionError:
break;
default:
packages.add(p);
@@ -116,6 +117,7 @@ public class TestsDatabase extends SQLiteDatabase {
case Done:
case Aborted:
case Draft:
case ConnectionError:
break;
default:
//активен.

View File

@@ -96,7 +96,9 @@ public class UserConnection {
if (sftpChannel != null) sftpChannel.disconnect();
if (shellChannel != null) shellChannel.disconnect();
if (execChannel != null) execChannel.disconnect();
if (session != null) session.disconnect();
if (session != null) {
session.disconnect();
}
//----------------------
sftpChannel = null;
shellChannel = null;