Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
57a7d1bc
Commit
57a7d1bc
authored
9 years ago
by
Shwetha GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-194 Thread pool in hive hook should be static (shwethags)
parent
9ebfd1b1
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
33 deletions
+32
-33
HiveHook.java
...ge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
+31
-33
release-log.txt
release-log.txt
+1
-0
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
View file @
57a7d1bc
...
...
@@ -24,7 +24,6 @@ import com.google.inject.Guice;
import
com.google.inject.Inject
;
import
com.google.inject.Injector
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.hive.bridge.HiveMetaStoreBridge
;
import
org.apache.atlas.hive.model.HiveDataTypes
;
import
org.apache.atlas.notification.NotificationInterface
;
...
...
@@ -89,7 +88,7 @@ public class HiveHook implements ExecuteWithHookContext {
private
static
final
long
keepAliveTimeDefault
=
10
;
private
static
boolean
typesRegistered
=
false
;
private
final
Configuration
atlasProperties
;
private
static
Configuration
atlasProperties
;
class
HiveEvent
{
public
HiveConf
conf
;
...
...
@@ -106,44 +105,43 @@ public class HiveHook implements ExecuteWithHookContext {
}
@Inject
private
NotificationInterface
notifInterface
;
public
HiveHook
()
throws
AtlasException
{
atlasProperties
=
ApplicationProperties
.
get
(
ApplicationProperties
.
CLIENT_PROPERTIES
);
// initialize the async facility to process hook calls. We don't
// want to do this inline since it adds plenty of overhead for the query.
HiveConf
hiveConf
=
new
HiveConf
();
int
minThreads
=
hiveConf
.
getInt
(
MIN_THREADS
,
minThreadsDefault
);
int
maxThreads
=
hiveConf
.
getInt
(
MAX_THREADS
,
maxThreadsDefault
);
long
keepAliveTime
=
hiveConf
.
getLong
(
KEEP_ALIVE_TIME
,
keepAliveTimeDefault
);
executor
=
new
ThreadPoolExecutor
(
minThreads
,
maxThreads
,
keepAliveTime
,
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(),
new
ThreadFactoryBuilder
().
setNameFormat
(
"Atlas Logger %d"
).
build
());
private
static
NotificationInterface
notifInterface
;
static
{
try
{
Runtime
.
getRuntime
().
addShutdownHook
(
new
Thread
()
{
@Override
public
void
run
()
{
try
{
executor
.
shutdown
();
executor
.
awaitTermination
(
WAIT_TIME
,
TimeUnit
.
SECONDS
);
executor
=
null
;
}
catch
(
InterruptedException
ie
)
{
LOG
.
info
(
"Interrupt received in shutdown."
);
atlasProperties
=
ApplicationProperties
.
get
(
ApplicationProperties
.
CLIENT_PROPERTIES
);
// initialize the async facility to process hook calls. We don't
// want to do this inline since it adds plenty of overhead for the query.
int
minThreads
=
atlasProperties
.
getInt
(
MIN_THREADS
,
minThreadsDefault
);
int
maxThreads
=
atlasProperties
.
getInt
(
MAX_THREADS
,
maxThreadsDefault
);
long
keepAliveTime
=
atlasProperties
.
getLong
(
KEEP_ALIVE_TIME
,
keepAliveTimeDefault
);
executor
=
new
ThreadPoolExecutor
(
minThreads
,
maxThreads
,
keepAliveTime
,
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(),
new
ThreadFactoryBuilder
().
setNameFormat
(
"Atlas Logger %d"
).
build
());
Runtime
.
getRuntime
().
addShutdownHook
(
new
Thread
()
{
@Override
public
void
run
()
{
try
{
executor
.
shutdown
();
executor
.
awaitTermination
(
WAIT_TIME
,
TimeUnit
.
SECONDS
);
executor
=
null
;
}
catch
(
InterruptedException
ie
)
{
LOG
.
info
(
"Interrupt received in shutdown."
);
}
// shutdown client
}
// shutdown client
}
});
}
catch
(
IllegalStateException
is
)
{
LOG
.
info
(
"Attempting to send msg while shutdown in progress."
);
});
}
catch
(
Exception
e
)
{
LOG
.
info
(
"Attempting to send msg while shutdown in progress."
,
e
);
}
LOG
.
info
(
"Created Atlas Hook"
);
Injector
injector
=
Guice
.
createInjector
(
new
NotificationModule
());
notifInterface
=
injector
.
getInstance
(
NotificationInterface
.
class
);
LOG
.
info
(
"Created Atlas Hook"
);
}
@Override
...
...
This diff is collapsed.
Click to expand it.
release-log.txt
View file @
57a7d1bc
...
...
@@ -9,6 +9,7 @@ ATLAS-54 Rename configs in hive hook (shwethags)
ATLAS-3 Mixed Index creation fails with Date types (suma.shivaprasad via shwethags)
ALL CHANGES:
ATLAS-194 Thread pool in hive hook should be static (shwethags)
ATLAS-180 Cleanup atlas doc packaging (shwethags)
ATLAS-147 Fix a code issue when defineTypes (ltfxyz via shwethags)
ATLAS-110 UI: Lineage should be clickable (Vishal Kadam via Venkatesh Seetharam)
...
...
This diff is collapsed.
Click to expand it.
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