Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
23520fb8
Commit
23520fb8
authored
Dec 16, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UObject): добавлены попытки регистрации и активации объекта
parent
f66ca1fe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
33 deletions
+56
-33
libuniset2.spec
conf/libuniset2.spec
+4
-1
UniSetObject.h
include/UniSetObject.h
+2
-2
UInterface.cc
src/Interfaces/UInterface.cc
+1
-1
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+49
-29
No files found.
conf/libuniset2.spec
View file @
23520fb8
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
Name: libuniset2
Name: libuniset2
Version: 2.6
Version: 2.6
Release: alt
8
Release: alt
9
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
License: LGPL
...
@@ -507,6 +507,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
...
@@ -507,6 +507,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# history of current unpublished changes
# history of current unpublished changes
%changelog
%changelog
* Fri Dec 16 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt9
- UObject: added attempts to activate the object
* Wed Dec 14 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt8
* Wed Dec 14 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt8
- SM: terminate if read dump (configuration) failed
- SM: terminate if read dump (configuration) failed
...
...
include/UniSetObject.h
View file @
23520fb8
...
@@ -221,9 +221,9 @@ namespace uniset
...
@@ -221,9 +221,9 @@ namespace uniset
//! Непосредственная активизация объекта
//! Непосредственная активизация объекта
bool
activate
();
bool
activate
();
/* регистрация в репозитории объектов */
/* регистрация в репозитории объектов */
void
regist
ered
();
void
regist
ration
();
/* удаление ссылки из репозитория объектов */
/* удаление ссылки из репозитория объектов */
void
unregist
er
();
void
unregist
ration
();
void
initObject
();
void
initObject
();
...
...
src/Interfaces/UInterface.cc
View file @
23520fb8
...
@@ -851,7 +851,7 @@ namespace uniset
...
@@ -851,7 +851,7 @@ namespace uniset
string
nodeName
(
s
.
str
());
string
nodeName
(
s
.
str
());
string
bname
(
nodeName
);
// сохраняем базовое название
string
bname
(
nodeName
);
// сохраняем базовое название
for
(
unsigned
in
t
curNet
=
1
;
curNet
<=
uconf
->
getCountOfNet
();
curNet
++
)
for
(
size_
t
curNet
=
1
;
curNet
<=
uconf
->
getCountOfNet
();
curNet
++
)
{
{
try
try
{
{
...
...
src/ObjectRepository/UniSetObject.cc
View file @
23520fb8
...
@@ -224,13 +224,13 @@ namespace uniset
...
@@ -224,13 +224,13 @@ namespace uniset
return
receiveMessage
();
return
receiveMessage
();
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
UniSetObject
::
regist
ered
()
void
UniSetObject
::
regist
ration
()
{
{
ulogrep
<<
myname
<<
": registration..."
<<
endl
;
ulogrep
<<
myname
<<
": registration..."
<<
endl
;
if
(
myid
==
uniset
::
DefaultObjectId
)
if
(
myid
==
uniset
::
DefaultObjectId
)
{
{
ulogrep
<<
myname
<<
"(regist
ered
): Don`t registration. myid=DefaultObjectId
\n
"
;
ulogrep
<<
myname
<<
"(regist
ration
): Don`t registration. myid=DefaultObjectId
\n
"
;
return
;
return
;
}
}
...
@@ -238,7 +238,7 @@ namespace uniset
...
@@ -238,7 +238,7 @@ namespace uniset
if
(
!
m
)
if
(
!
m
)
{
{
uwarn
<<
myname
<<
"(regist
ered
): unknown my manager"
<<
endl
;
uwarn
<<
myname
<<
"(regist
ration
): unknown my manager"
<<
endl
;
string
err
(
myname
+
": unknown my manager"
);
string
err
(
myname
+
": unknown my manager"
);
throw
ORepFailed
(
err
);
throw
ORepFailed
(
err
);
}
}
...
@@ -248,18 +248,20 @@ namespace uniset
...
@@ -248,18 +248,20 @@ namespace uniset
if
(
!
oref
)
if
(
!
oref
)
{
{
u
crit
<<
myname
<<
"(registered
): oref is NULL!..."
<<
endl
;
u
warn
<<
myname
<<
"(registration
): oref is NULL!..."
<<
endl
;
return
;
return
;
}
}
}
}
try
auto
conf
=
uniset_conf
();
{
regOK
=
false
;
for
(
unsigned
int
i
=
0
;
i
<
2
;
i
++
)
for
(
size_t
i
=
0
;
i
<
conf
->
getRepeatCount
();
i
++
)
{
{
try
try
{
{
ui
->
registered
(
myid
,
getRef
(),
true
);
ui
->
registered
(
myid
,
getRef
(),
true
);
regOK
=
true
;
break
;
break
;
}
}
catch
(
ObjectNameAlready
&
al
)
catch
(
ObjectNameAlready
&
al
)
...
@@ -274,29 +276,30 @@ namespace uniset
...
@@ -274,29 +276,30 @@ namespace uniset
если заменяемый объект "жив" и завершит свою работу, то он может почистить за собой ссылку и это тогда наш(новый)
если заменяемый объект "жив" и завершит свою работу, то он может почистить за собой ссылку и это тогда наш(новый)
объект станет недоступен другим, а знать об этом не будет!!!
объект станет недоступен другим, а знать об этом не будет!!!
*/
*/
ucrit
<<
myname
<<
"(registered): replace object (ObjectNameAlready)"
<<
endl
;
uwarn
<<
myname
<<
"(registration): replace object (ObjectNameAlready)"
<<
endl
;
regOK
=
true
;
unregistration
();
unregister
();
}
}
}
}
catch
(
uniset
::
ORepFailed
)
catch
(
ORepFailed
)
{
{
string
err
(
myname
+
": don`t registration in object reposotory"
);
uwarn
<<
myname
<<
"(registration): don`t registration in object reposotory "
<<
endl
;
uwarn
<<
myname
<<
"(registered): "
<<
err
<<
endl
;
throw
ORepFailed
(
err
);
}
}
catch
(
const
uniset
::
Exception
&
ex
)
catch
(
const
uniset
::
Exception
&
ex
)
{
{
uwarn
<<
myname
<<
"(registered): "
<<
ex
<<
endl
;
uwarn
<<
myname
<<
"(registration): "
<<
ex
<<
endl
;
string
err
(
myname
+
": don`t registration in object reposotory"
);
throw
ORepFailed
(
err
);
}
}
regOK
=
true
;
msleep
(
conf
->
getRepeatTimeout
());
}
if
(
!
regOK
)
{
string
err
(
myname
+
"(registration): don`t registration in object reposotory"
);
ucrit
<<
err
<<
endl
;
throw
ORepFailed
(
err
);
}
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
UniSetObject
::
unregist
er
()
void
UniSetObject
::
unregist
ration
()
{
{
if
(
myid
<
0
)
// || !reg )
if
(
myid
<
0
)
// || !reg )
return
;
return
;
...
@@ -529,7 +532,7 @@ namespace uniset
...
@@ -529,7 +532,7 @@ namespace uniset
uwarn
<<
myname
<<
"(deactivate): "
<<
ex
.
what
()
<<
endl
;
uwarn
<<
myname
<<
"(deactivate): "
<<
ex
.
what
()
<<
endl
;
}
}
unregist
er
();
unregist
ration
();
PortableServer
::
ObjectId_var
oid
=
poamngr
->
servant_to_id
(
static_cast
<
PortableServer
::
ServantBase
*>
(
this
));
PortableServer
::
ObjectId_var
oid
=
poamngr
->
servant_to_id
(
static_cast
<
PortableServer
::
ServantBase
*>
(
this
));
poamngr
->
deactivate_object
(
oid
);
poamngr
->
deactivate_object
(
oid
);
uinfo
<<
myname
<<
"(disacivate): finished..."
<<
endl
;
uinfo
<<
myname
<<
"(disacivate): finished..."
<<
endl
;
...
@@ -587,12 +590,18 @@ namespace uniset
...
@@ -587,12 +590,18 @@ namespace uniset
throw
ORepFailed
(
err
);
throw
ORepFailed
(
err
);
}
}
bool
actOK
=
false
;
auto
conf
=
uniset_conf
();
for
(
size_t
i
=
0
;
i
<
conf
->
getRepeatCount
();
i
++
)
{
try
try
{
{
if
(
uniset_conf
()
->
isTransientIOR
()
)
if
(
conf
->
isTransientIOR
()
)
{
{
// activate witch generate id
// activate witch generate id
poa
->
activate_object
(
static_cast
<
PortableServer
::
ServantBase
*>
(
this
));
poa
->
activate_object
(
static_cast
<
PortableServer
::
ServantBase
*>
(
this
));
actOK
=
true
;
break
;
}
}
else
else
{
{
...
@@ -600,7 +609,7 @@ namespace uniset
...
@@ -600,7 +609,7 @@ namespace uniset
// то myname = noname. ВСЕГДА!
// то myname = noname. ВСЕГДА!
if
(
myid
==
uniset
::
DefaultObjectId
)
if
(
myid
==
uniset
::
DefaultObjectId
)
{
{
ucrit
<<
myname
<<
"(activate): Не задан ID!!! activate failure
..."
<<
endl
;
uwarn
<<
myname
<<
"(activate): Не задан ID!!! IGNORE ACTIVATE
..."
<<
endl
;
// вызываем на случай если она переопределена в дочерних классах
// вызываем на случай если она переопределена в дочерних классах
// Например в UniSetManager, если здесь не вызвать, то не будут инициализированы подчинённые объекты.
// Например в UniSetManager, если здесь не вызвать, то не будут инициализированы подчинённые объекты.
// (см. UniSetManager::activateObject)
// (см. UniSetManager::activateObject)
...
@@ -609,13 +618,12 @@ namespace uniset
...
@@ -609,13 +618,12 @@ namespace uniset
}
}
// Always use the same object id.
// Always use the same object id.
PortableServer
::
ObjectId_var
oid
=
PortableServer
::
ObjectId_var
oid
=
PortableServer
::
string_to_ObjectId
(
myname
.
c_str
());
PortableServer
::
string_to_ObjectId
(
myname
.
c_str
());
// cerr << myname << "(activate): " << _refcount_value() << endl;
// Activate object...
// Activate object...
poa
->
activate_object_with_id
(
oid
,
this
);
poa
->
activate_object_with_id
(
oid
,
this
);
actOK
=
true
;
break
;
}
}
}
}
catch
(
const
CORBA
::
Exception
&
ex
)
catch
(
const
CORBA
::
Exception
&
ex
)
...
@@ -631,12 +639,24 @@ namespace uniset
...
@@ -631,12 +639,24 @@ namespace uniset
uwarn
<<
myname
<<
"(activate): IGNORE.. catch "
<<
ex
.
_name
()
<<
endl
;
uwarn
<<
myname
<<
"(activate): IGNORE.. catch "
<<
ex
.
_name
()
<<
endl
;
}
}
msleep
(
conf
->
getRepeatTimeout
()
);
}
if
(
!
actOK
)
{
ostringstream
err
;
err
<<
myname
<<
"(activate): DON`T ACTIVATE.."
;
ucrit
<<
myname
<<
"(activate): "
<<
err
.
str
()
<<
endl
;
throw
uniset
::
SystemError
(
err
.
str
());
}
{
{
uniset
::
uniset_rwmutex_wrlock
lock
(
refmutex
);
uniset
::
uniset_rwmutex_wrlock
lock
(
refmutex
);
oref
=
poa
->
servant_to_reference
(
static_cast
<
PortableServer
::
ServantBase
*>
(
this
)
);
oref
=
poa
->
servant_to_reference
(
static_cast
<
PortableServer
::
ServantBase
*>
(
this
)
);
}
}
registered
();
registration
();
// Запускаем поток обработки сообщений
// Запускаем поток обработки сообщений
setActive
(
true
);
setActive
(
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment