Archives August 2024

Stephen’s Last Stand Part 2 (Acts 6:8-10)

The Ministry of the Spirit in Stephen (Acts 6:8-15)

8 And Stephen, full of faith and power, did great wonders and signs among the people. 9 Then there arose some from what is called the Synagogue of the Freedmen (Cyrenians, Alexandrians, and those from Cilicia and Asia), disputing with Stephen. 10 And they were not able to resist the wisdom and the Spirit by which he spoke.

The Special Abilities of Stephen (Acts 6:8) — The former mentions of signs and wonders among the people were about work done by the Spirit through the apostles (Acts 2:43; 3:1-9; 4:33; 5:12, 15). This is the first time that we hear of supernatural work being done by the Spirit through people outside of the twelve. Why? That is, (1) why were these abilities formerly only seen in the apostles and (2) what changed?

The signs, miracles, and wonders of the apostles, and Jesus before them, served to certify that they were sent by God (John 3:1-2; Acts 2:22). Think with me on the purpose of such power in the life of the Lord. Jesus pointed to the signs and wonders being done through Him when He encountered detractors. He used them to reinforce His claims when people expressed reservations about receiving a Messiah from Nazareth:

  • The Works Were Given to Help Get Over Unbelief (John 10:37-38) — If I do not do the works of My Father, do not believe Me; but if I do, though you do not believe Me, believe the works, that you may know and believe that the Father is in Me, and I in Him.
  • The Works Were to Help Deal with Doubt (John 14:11) — Believe Me that I am in the Father and the Father in Me, or else believe Me for the sake of the works themselves.

The supernatural works being done through Jesus were aimed at helping people believe in Jesus. Through the works the Father attested to the veracity of the Son’s claims (Acts 2:22). The ministry of Jesus was validated by His miracles.

The ministry of the apostles was also validated by signs, wonders, and miracles (Hebrews 2:3-4). Through supernatural acts Jesus was made more credible. And through similar works the apostles were also validated. And so it is with the new deacons. That is, the signs and wonders serve as validation for deacons Stephen (Acts 6:8) and Philip (Acts 8:5-8). Stephen is now doing great wonders and signs among the people (Acts 6:8). In this way the new deacon is authenticated. Like Jesus and his apostles, the man upon whom the apostles have laid their hands is now being certified by miracles. Through the miracles Stephen is given a platform for promoting faith in Christ. Like Jesus and the apostles, Stephen is using the spotlight created by the miracles for declaring the word of God. And the Holy Spirit is on board with this plan; it is all part of the plan. Stephen is now someone to be regarded as having sound doctrine and speaking the words of life (Titus 1:9; 1 Timothy 3:9). And he was teaching!

The Speech of Stephen (Acts 6:9-10) — The teaching ministry of Stephen was controversial. He was saying things that disturbed both the camps of the Pharisees and the Sadducees. On account of Stephen’s teachings there arose men from five different synagogues disputing with him.

Freedmen were former slaves (or the children of former slaves) who had been emancipated by their owners; if their owners were Roman citizens, their freedmen were enrolled as members of their family. Many Jews who were taken captive to Rome at the time of Pompey’s conquest of Judaea (63 B.C.) were subsequently emancipated and thenceforth had the status of freedmen. (Bruce, 1988, p. 125)

Those who argued with Stephen were Hellenists; they were Greek-speaking Jews that were formerly dispersed among the nations. They have now come back to Jerusalem and gather according to cultural affinities.

In this verse, the term “synagogue” is singular, but Luke named five of them. First, there was the synagogue of the Libertines, a word that means “freedmen.” These were Jews who were once slaves of Rome or sons of Jewish slaves of Rome, but now had been freed. They came from Rome and built their own synagogue. Second, there was the synagogue of the Cyrenians, Jews from North Africa. Third, there was the synagogue of the Alexandrians, Jews from Egypt. The Jerusalem Talmud states that they built their synagogue at their own expense. The Babylonian Talmud tells the story of Rabbi Eliezer Ben Zadok, who acquired from some Alexandrian Jews a building formerly used as a private synagogue[ 148] “and turned it to his own use.”[ 149] Fourth, there was the synagogue of Cilicia, built by Jews who came from Asia Minor or present-day Turkey. The province of Cilicia included the city of Tarsus. Hence, these were people who came from the same region as Paul, and this synagogue of the Cilicians may very well have been his place of worship. That may also mean that he would have been involved in the disputations with Stephen and would have been among those who lost their arguments with him. Finally, there was the synagogue of Asia, meaning other parts of Asia Minor. (Fruchtenbaum, 2020, Kindle Locations 2805-2815)

But in their midst is a Hellenist full of faith and power, performing miracles, and preaching things that sound like blasphemy. They tried to take Stephen on and refute his statements. But he defeated all of them; they were not able to resist the wisdom and the Spirit by which he spoke (Acts 6:10). What is going on? Is Stephen so smart that he can best anyone in an argument? While he was likely intelligent and certainly wise (Acts 6:3), that is not why he has become unbeatable in debate. Stephen, my fellow Jesus follower, is filled with the Spirit. (See the previous post in this series.) His invincible power in verbal combat is actually the outworking of God’s presence in a chosen vessel.

  • The Precedent of God’s Presence for His Servant’s Speech (Exodus 4:12; Numbers 11:17) — Between 1,300 and 1,500 years before Jesus, God told a man who was not a capable speaker that he be helped with speaking. What man? Moses. Here below is Moses’ self assessment of his speaking abilities:

O my Lord, I am not eloquent, neither before nor since You have spoken to Your servant; but I am slow of speech and slow of tongue. (Exodus 4:10, NKJV)

Figure 1 – Moses protested his calling to lead based on his difficulty speaking.

Do you see it? That is, do you see Moses’ low view of his own speaking abilities? In his own words he was not eloquent. No. Instead he had some problem speaking that made his oration slow in delivery and perhaps pronunciation. Did he stammer? Whatever the problem was, in light of the help he had, it was actually not a problem. In the moment and as needed God would enable Moses to speak. His mouth was aided by the indwelling Spirit in saying what the occasion required. This is God’s response of encouragement and about the help His servant would have in speaking:

Now therefore, go, and I will be with your mouth and teach you what you shall say. (Exodus 4:12, NKJV)

  • The Power is Unbeatable (Isaiah 54:17) — Between 700 and 740 years before Christ, Isaiah the prophet will add some clarity to what God will do through to make his spokespersons effective. Isaiah says that dealing successfully with opposition in our response to attacks is our heritage; when the time comes, we do not back down from the difficulty or danger associated with declaring the truth. This will be played out in the text that follows. The weapons formed against Stephen will not prosper.

“No weapon formed against you shall prosper,
And every tongue which rises against you in judgment
You shall condemn.
This is the heritage of the servants of the Lord,
And their righteousness is from Me,”
Says the Lord. (Isaiah 54:17, NKJV)

Further, instead of being condemned, the man of God will speak cutting truth about his accusers (Acts 7:54).

  • The Promise of In-the-Moment Provisions of Irresistible Speech (Luke 21:12-15) — Jesus prepared his disciples for the moments when they would need to give an answer to their adversaries. He told them that they would be put on trial for the benefit of His Person and program (Luke 21:12). Jesus said those trials will look, at first glance, like a day of triumph for the enemy. However, it will be your opportunity! The Son of Man says, in effect, “What the devil would use as a time to demean you and discourage you will become a singular time of telling them the truth about who I am” (Luke 21:13); “The setback of being made to stand before your accusers will actually be a setup for you to stand for the Truth” (John 14:6).

What do we do with this? We are not far enough through the narrative of what happens to Stephen to say. Not enough of Luke’s account of the trial of Stephen has been considered. We need more to know how to operate in our day to face opposition? But here are some questions that will help us to think deeply about the text and God’s reasons for wanting us to be filled with the Spirit.

Questions for Group Discussion

  1. What is the purpose of exceptional or supernatural work in the life of a believer?
  2. Am I ever guilty of taking credit for what God is doing through me for His own purposes?
  3. What would God have me do with the attention garnered through great work?
  4. Am I preparing to use the platform occasioned by good performance to proclaim the truth about Jesus? Things that can help me to prepare for questions are (1) a time to pray for understanding, (2) a reading plan, and (3) study aimed at learning to explain the truth to others (Ezra 7:10).
  5. Do I regard the company of God as sufficient equipping for everything I will face (Joshua 1:9; Matthew 28:20)? In what ways do I discount the value of God’s help? How could I be more positive about the provisions of God (Luke 21:12-15; Philippians 4:8)?

Note: The featured image for this post is of a friend and mentor — Pastor Dave Smith. One thing that Dave has taught me about being effective as a speaker is the importance of reviewing the entire message a few times before presenting. In the photo it is Sunday, 21 March 2021 and Pastor Dave is guest speaking at Communion Chapel.

Stephen’s Last Stand Part 1 (Acts 6:1)

Introduction

When we receive Jesus we receive pardon, we receive purpose, and we receive the Person of the Holy Spirit (Ephesians 1:13). Once He has come gone are the days of being without power, without counsel, without comfort, without companionship (John 14:15-18). Through the Holy Spirit the Lord keeps His promise to (1) never leave us nor forsake us (Matthew 28:20; Hebrews 13:5) and (2) enable us for amazing acts of service. But with His coming also comes the unresolvable conflict that results from being indwelt by the Spirit of Christ. When the Jesus follower surrenders gladly and becomes Spirit-filled, he also becomes, from the world’s perspective, as irritating as Jesus.

While we should always endeavor to promote peace, love our enemies, and be a blessing to the community – we should not be surprised when living like Jesus brings out unavoidable angst toward us from the world. Some believers, having failed to see or accept this truth, are working in vain to make peace with the world. They have a great zeal for Jesus. But the same believer is terribly wrong in thinking that their white hot faith is compatible with a society that is surrendered to Satan and cold toward Christ. The account in Acts 6:8-8:4, with the focus on Stephen, shows us as much.

The narrative about Stephen constitutes a major turning point in Acts. It ends a series of three trials before the Sanhedrin. The first ended in a warning (4:21), the second in a flogging (5:40), and Stephen’s in his death. (Polhill, 1992, p. 183)

In the few verses under consideration we see the consequence of being Spirit-filled.

Called to Conflict (Acts 6:8)

Luke has presented the Lord and His apostles as having power to perform signs and wonders (Luke 2:40; 4:1,14-15; Acts 2:43; 5:12). Now, for the first time in the records of Luke we are hearing of wonders and signs among the people being done through someone other than the Lord or one His apostles.

[Stephen] was the first other than the apostles to be described as working miracles. (Polhill, 1992, p. 184)

A naive reading of this verse begins to cheer about this new thing: regular people of faith are doing great work. But do not miss the fact that Stephen has already been introduced as a (1) a man full of the Holy Spirit and wisdom (Acts 6:3), (2) man full of faith and the Holy Spirit (Acts 6:5). If you are mindful of his introduction the words of Acts 6:8 seem odd. You might think, “Okay. He was full of the Holy Spirit. It has been said three times. Got it!” But this third mention should make me ask if the author is trying to tell me something through the pattern of words (full of the Holy Spirit) and their rapid repetition (Acts 6:3, 5, 8). What do we find in the writings of Luke?

  • Before Jesus’ Temptation in the Wilderness (Luke 4:1) – Jesus is said to be full of the Holy Spirit before He enters terrible conflict with Satan. He is victorious but certainly worn down and needed refreshing (Matthew 4:11).
  • Before Jesus Rejection at Home (Luke 4:14-15) – Again Luke relates that the presence and power of the Spirit are pronounced in the man from Nazareth. This is what we are told just before Jesus’ claims cause anger in His hometown synagogue. He is successful in demonstrating the nearness of the kingdom but they try to kill him by throwing Him down over a cliff (Luke 4:28-30).
  • Before Peter Preaches to the Sanhedrin (Acts 4:8-12) – These words are used before Peter indicts the court and makes one of the most inflammatory remarks of Scripture – especially to a group that had just murdered the Messiah.

It does not take a Bible sleuth to see that where these words occur in the writings of Luke, we can expect to see conflict that cannot be resolved. The Spirit-filled person was called to it! The story with Stephen is no exception. Indeed, because of the threefold mention of his filling with the Spirit we should expect unprecedented animosity.

References

Polhill, J. B. (1992). Acts. Nashville: Broadman & Holman Publishers.

Missional Living — Maximizing Your Ministry Part 3, Delegate Some Duties (Acts 6:1-7)

Maximizing Your Ministry Part 3 – Delegate Some Duties (Acts 6:1-7)

Acts 6:3 The apostles had already discussed among themselves the issue at hand. By the time they disclosed their assessment they were ready to give direction to the church. They directed the disciples to seek out seven… of good reputation. What kind of people? They give the qualifications along with the quantity requirement; essentially these are deacons.

  • Male (1 Timothy 3:8-12) – Although there are many teachers who would like to neuter this text, the direction of the apostles is not vague; they instructed the disciples, both men and women, to select seven men (ἄνδρας). The word for deacon does occur in the feminine in the New Testament (Romans 16:1). But in the identification of a role of a deacon, Peter and Paul, provide descriptions that are masculine. For example, in his letter to Timothy, Paul makes it clear that the deacon cannot be the husband of more than one wife. If the role were truly gender neutral, the same man who wrote that in Christ there is neither male nor female (Galatians 3:28), could have said as much when writing to Timothy.
  • Reputable (Ecclesiastes 7:1; 2 Corinthians 8:18; 1 Timothy 3:8-9) – The men serving this role must have a good reputation. They will help to quell the complaining that arose if they can be trusted. Otherwise suspicions about their actions and motives will only make matters worse.
  • Spirit-Filled (Galatians 5:22-23; Ephesians 5:18-19) – The work of God cannot be based on human giftedness. Those who would work effectively in the church must be not just indwelt by the Spirit; they must be filled. This means controlled.
  • Wise (1 Corinthians 2:12-13; Colossians 1:9; James 3:17) – Those who are led by the Spirit of God are not necessarily able to communicate effectively or help a group through a decision. They are surrendered in their heart but not wired to lead. The persons who will serve in this capacity must demonstrate the ability to take the counsel of the Spirit and use it to effect good results for a group.

Acts 6:4 What are the apostles going to do? That is, when seven men selected to handle this distribution have been put into place, what is left for the apostles to do? Without the duty of serving tables the apostles are freed up for their calling. Liberated from a work that they can do but are not called to, the twelve are going to give themselves continually to two things: (1) to prayer (Romans 12:12; Ephesians 6:18) and (2) the ministry of the word.

68.68 προσκαρτερέωa; προσκαρτέρησις, εως f: to continue to do something with intense effort, with the possible implication of despite difficulty—‘to devote oneself to, to keep on, to persist in.’ (Louw, 1996, p. 662)

The church does not have the written gospels or the epistles. Until these important documents have been created, the apostles are responsible for teaching the words of Christ to the people (Matthew 28:18-20). The work is difficult and requires focus and considerable time in prayer. In fact, when we consider the order of what the apostles will be devoted to, prayer is first. Our apostles are telling us two things:

The Principle of Putting Prayer FirstPrayer is the prerequisite to preaching the word. Prayer is the non-negotiable need for a ministry of teaching the word. The apostles are telling us that those who would do well in a ministry of the word must hand themselves over to it. To what? To prayer! Those who would succeed in this work must turn themselves in for the unending undertaking of pleading for what is needed for the people of God.

The twelve make it clear that there must be a nonstop calling out to God for His help in (1) understanding the Scriptures, (2) explaining the Scriptures, and (3) asking for God’s grace in the heart of the listeners. After this, excellence in a calling to the ministry of the word requires a dogged determination to dig deep without distraction.

Questions for Consideration

  1. Would I be described as given continually to the the work that God has called me to do (1 Timothy 4:15)? Imagine what your ministry would look like if you did not have to stop for things that are good but not what you are called to do?
  2. Is prayer prominently featured in your ministry. Notice that the apostles are not

Missional Living — Maximizing Your Ministry Part 2, Concentrate on the Calling (Acts 6:1-7)

Concentrate on the Calling (Acts 6:1-4)

1 Now in those days, when the number of the disciples was multiplying, there arose a complaint against the Hebrews by the Hellenists, because their widows were neglected in the daily distribution. 2 Then the twelve summoned the multitude of the disciples and said, “It is not desirable that we should leave the word of God and serve tables. 3 Therefore, brethren, seek out from among you seven men of good reputation, full of the Holy Spirit and wisdom, whom we may appoint over this business; 4 but we will give ourselves continually to prayer and to the ministry of the word.”

Acts 6:1 The new community has been characterized by unity and sharing (Acts 4:32). In the recent past people that owned land or houses sold them and brought the proceeds to be distributed according to needs (Acts 4:34-35). Out of this generosity the needs of all the people were met — until they weren’t. At some point it became obvious that the distribution stopped being fair. Greek-speaking Jews (Hellenists) noticed that their Greek-speaking widows were neglected in the daily distribution of alms. The Hellenist’s complaint against the Hebrews, a quiet grumbling that eventually erupted in open criticism, was that the Hebrews were only taking care of Hebrew widows; Hellenistic widows were overlooked.

The care of the widows is good. But when the care is not done carefully it can cause hard feelings, discontent, and even division. Although the number of disciples was multiplying not everyone was feeling good about how their fellowship was treating the Hellenistic widows. Can you imagine the complaint?

“Excuse me, Peter, John, and the other apostles. Sorry to bother you guys with this but the Hellenists or Greek-speaking Jews are upset because their widows are neglected by the Hebrews in the daily distribution of alms. That is, when the food pantry or money is given out, the Greek-speaking widows typically get less or are left out altogether.”

The Hellenists were Jews that had been “born outside the Land but had moved into the Land of Israel. These are the Diaspora Jews. Jews from the Dispersion who had migrated back into the Land of Israel” (Fruchtenbaum, 2020). They believed in Yahweh, had practiced Judaism, and had become followers of Jesus. However, owing to their long and multi-generational residence in other countries, they did not speak Hebrew. Does this matter to us today? Let’s talk ministry effectiveness. For those who would serve their subcultures well, it does. Serving your church well means being able to communicate effectively. This is not entirely based on your own ability to articulate the meaning of a passage or lead people in worship. It also means being able to listen well to people that we love when they are in difficult moments. In those moments, if their first language is not your first language, the ministry may be operating below its capacity.

The desire to speak one’s native tongue during times of high emotional is a deeply rooted psychological and cultural phenomenon. This behavior is often seen in multilingual individuals who, despite proficiency in other languages, revert to their first language when experiencing intense emotions such as fear, anger, grief, or joy. For those who would bring excellence to the service of people whose first language is something other than their own, without the ability to speak the language of the people you are serving, things are being missed. Consider diversifying your team. Prayerfully look at adding people to the team that speak the languages of the demographics you are serving. Why?

Psychological and Neurological Factors Favoring Diversity

  • Emotional Resonance — The native language, often learned in early childhood, is intricately tied to an individual’s emotional development. Emotional experiences and expressions are encoded in this language. This means that the first langauge is the most natural medium for articulating deep-seated feelings (Pavlenko, 2005).
  • Cognitive Load — Speaking a non-native language requires additional cognitive resources, as it involves not just language production but also the management of grammatical structures, vocabulary, and pronunciation. During emotional turmoil, cognitive load increases, and individuals may find it more challenging to maintain fluency in a second language. Reverting to the native language, which is processed more automatically and with less cognitive effort, becomes a natural response. Ministry Relevance: When trying to comfort or counsel someone who prefers to speak in another language, their ability to clearly communicate their perspective may be inhibited by cognitive load. Having someone who can talk with the person in their native language allows them to spend less energy in the mental work of translating their feelings into your tongue and more energy in the effort to be transparent and clear.
  • Comfort and Identity — The native language is often closely linked to one’s identity and sense of self. In moments of vulnerability, people tend to seek comfort in familiar cultural symbols, including language. Speaking the native tongue provides a sense of security, continuity, and connection to one’s roots. This can be comforting during distressing times.

Sociolinguistic Perspectives

  • Cultural Context — Language is a core component of culture, and expressing emotions in the native tongue allows individuals to tap into culturally specific ways of understanding and articulating feelings. For example, certain emotional expressions or concepts may not have direct translations in other languages, making the native language the most effective way to communicate these nuances.
  • Social Bonds — Speaking the native language in times of emotional need can also be a way to strengthen social bonds with others who share the same language. It can signal a need for empathy and understanding from those within the same linguistic community, who are more likely to grasp the emotional subtleties being expressed.

Questions for Consideration

  1. Can you or anyone in the leadership team of your ministry or church fellowship readily list the ethnic groups you serve?
  2. How many groups are being served whose first-languages are not represented in the leadership team?

Acts 6:2 The twelve summoned the multitude of the disciples to disclose and direct. Trained by Jesus to lead they recognize the importance of ensuring the participation of the church laity in dealing with difficulty. First, they disclosed their assessment of the situation and how it related to their apostleship: It is not desirable that we should leave the word of God and serve tables. Notice that they did not speak against serving the widows. But they said they should not be the ones doing it. Some will see in their response a condescending attitude toward the needs of the poor. Some will read this passage and get the impression that the apostles believe themselves to be above serving widows. That is not the case. They have been trained to serve (Matthew 20:28; John 13:1-17), charged to serve (Luke 22:26; John 21:17; 1 Peter 5:3), and changed in order to serve effectively (John 14:26; 15:26). And they believe that serving the poor is an important part of church ministry (Galatians 2:10). In seeking to understand the response of the apostles we must prayerfully consider their calling. The apostles were to have a special foundation-laying ministry (Ephesians 2:20) of preaching, teaching, and penning the word. Each of the following passages sheds some light on their decision in this matter:

  • Their Call to Preaching was the Main Plan (Mark 3:14) – 14 Then He appointed twelve, that they might be with Him and that He might send them out to preach. This passage makes it clear that from the beginning Jesus had a preaching ministry in mind. Although He did teach them how to serve others in various ways, preaching was foremost among the reasons they were selected and trained.
  • Their Call to Preaching was Primary (Acts 5:20; Matthew 10:14) – The angel did not tell the apostles to return to the work of distributing aid to the widows; they were directed to return to the ministry of declaring and teaching the word of God.
  • Working with the Word was The Ministry of the Spirit Among the Apostles (John 14:23-26; John 16:13) – The apostles were supposed to teach all things that Jesus commanded (Matthew 28:18-20). The Spirit of God needed to have their undivided attention. As the Helper was bringing to remembrance what Jesus taught them, they could not be distracted by the distribution of alms. Such work could be done by someone else.

Who wants to see the pilot of the airplane coming down the aisle asking if you would like cookies or peanuts? A lot of people can do that job. But flying the plane requires special training and our lives depend on it being done well. We want the pilot to remain focused on flying.

  • The Call to Preaching was Personal (John 21:17) – Peter had pledged faithfulness but abandoned Jesus when he was faced with arrest and the promise of brutality. In a painful conversation with Peter the risen Lord both extended forgiveness and defined faithfulness. Jesus made it clear that the past failures were not important; He wanted Peter to go forward loving his Lord by feeding His sheep. And the love language of Jesus was not ambiguous: Feed His sheep, Peter! For Peter the priority of preaching was more than the common calling of Christ on their apostolic band; it was deeply personal to him.

It is with their calling in mind that they must say no to the request for their personal oversight and high participation in the distribution of alms to the poor. They say no in order that they would yes to what matters most – their calling. For the apostles, to personally prevent the problem that has been presented they would have had to take an enormous amount of time away from prayer and the ministry of the word. That would not be desirable; they were called and trained for a ministry of the word. As we consider the response of the apostles we are given a principle for our own day-to-day decisions about what we should and should not do. If we are going to render excellence to God and His people though our living, we do well to keep this in mind:

The Principle of High Quality Production — Excellence is never an accident. In order to effectively bring forth good fruit you must focus. There will be no casual completion of your calling. You must concentrate on your calling and cut out things that you are not called to do (1 Timothy 4:15). Being involved in many good things at the expense of your calling is not desirable to God.

Here is the question, friend: What can I do to become more fruitful in my calling? And here below are three things that will help you get answers and stay in His will.

  • Get Clarity on Your Calling (Mark 3:14; Matthew 10:14; John 15:20; John 14:23-26; John 21:17)
  • Regularly Review your Reasons (Psalm 1; Joshua 1:8) – Keep your plans for the year in view. Regularly retreat to review these plans and request from God insight into what needs to change. This helps with course correction when we begin to drift.
  • Delegate Some Duties (Exodus 18:1-27) – Failure to delegate is the undoing of many. For those of us who want the ministry to grow we must make it a priority to spend time (1) mentoring the next generation, (2) involving other gifted people in the work we do, and (3) casting vision for what will happen with real focus.

Before I was blessed with an opportunity to serve as a pastor at Three Rivers Community Church in Martindale I was a volunteer with a few ministries in San Antonio, Texas. I remember like it was yesterday talking with a friend in the hotel lobby during a break at a winter conference. I was serving as a speaker along with James Mendoza. (Pastor Mendoza is an outstanding leader and teacher at Vista Community Church in San Antonio, Texas.) While at the conference a friend and ministry staff member with the ministry I volunteered with asked if I was going to sign up for another year. As much as I enjoyed serving as a speaker for their conference and for the campuses served by that ministry, I was certain that I would not be going much further with them. Why? Because I was not leading.

And in my home church, although I was asked to serve as a leader of a good ministry in that fellowship, I was certain that I would not be staying. Why? Because I was not teaching. During that same period of time I was also asked if I would lead media ministries for two different organizations. I gave each of them a no. Why? Because if I had accepted those positions I would not be focused in the areas that God has equipped and called me: leading and teaching. Friend, you must stay with what God had called you to do. It is not desirable that you would leave your calling to serve in other capacities. Be undistracted! Some will regard your steadfast decision to be undistracted as an indicator of arrogance. That may be true; you may be arrogant. But don’t be ignorant of the truth about your calling – you need to concentrate on it. Saying no to others is about saying yes to God even more. Or, as is the case with the apostles, your “no” is the outworking of a clarity and confidence about the calling of Christ on your life. Saying “yes” to things that you are not called to do means saying “no” to being truly devoted to your calling.

The Principle of Equal and Opposite Answers — When we are asked to do something, we have to realize that saying yes will always mean saying no to something or someone else.

It is not arrogance or a lack of a servant’s heart that will lead you to turn down an “opportunity” when it means being less available for what God is asking of you.

Questions for Consideration

  1. Are you being asked to serve in ways that are within your skillset but outside your calling? Jesus had the skills or ability to do a lot of things. But he limited Himself to His father’s business.
  2. Itemize your duties and things you have agreed to do. Look over the list and identify which items are related to what you are called by God to do. Take a moment to put that list on a separate sheet of paper or in an electronic document. Ask some other godly people if they agree. Let the first person you ask be Jesus. And give Him time to reply. Do not immediately rush off to ask others.

References

Pavlenko, A. (2005). Emotions and Multilingualism. Cambridge University Press.

Notes

In the featured image of this post I am seen with Rev. Patrick (Forrest Hills Presbyterian Church), Christina (administrative assistant), and Joshua (UTSA student and way cool partner in ministry). We were fellowshipping a bit.

Missional Living — Maximizing Your Ministry Part 1 (Acts 6:1-7)

Maximizing Your Ministry Part 1 (Acts 6:1-7)

Introduction

The admonition to care for the poor is found throughout the Scriptures (Exodus 23:10-11; Leviticus 23:22; Deuteronomy 15:7-11; Esther 9:22; Psalm 14:6, 41:1; Proverbs 14:21; Matthew 11:5, 19:21; Romans 15:26; Galatians 2:10; Luke 14:13, 21). Caring for the poor is one way that a person in the community of faith does business with God (Proverbs 19:17) and honors Him. How does showing kindness to the poor honor God? There are at least two reasons why kindness to the poor honors God. First, the poor are made in the image of God (Genesis 1:27; Proverbs 14:31; 22:2); showing kindness to the poor is a way of showing respect for His image (1 John 4:20). Second, rendering compassion to the poor in our fellowships is one way we demonstrate our new birth (1 John 5:1).

Figure 1 – Poor people in the Bible come in many types. Especially important to God are widows (James 1:27).

Within the segment of society regarded as poor there is a subsection that is especially dear to God’s heart: widows and orphans (Exodus 22:22-24; Deuteronomy 10:18; Psalm 68:5; Proverbs 15:25; James 1:26-27). Widows, especially in the time of the first church, were particularly vulnerable to poverty. The agencies of modern governments that care for the poor did not exist. But the early church, under its apostolic leadership, had been mindful of this group. There was a daily distribution of alms aimed at meeting the needs of widows. This distribution to the widows had worked for a while; it had been effective when the church was fairly homogenous. But with exponential growth in the fellowship came a corresponding diversity in the demographics. The church is now comprised of local Jews and those that have immigrated to Jerusalem. The local Jews speak Aramaic (or Mishnaic Hebrew). Those that have immigrated to Jerusalem are called Hellenists (Acts 6:1). Who are the Hellenists and how do they differ from the Hebrews? F.F. Bruce summarizes:

The church of Jerusalem, we are now told, comprised both “Hebrews” and “Hellenists.” The main distinction between the two groups was probably linguistic: the Hellenists were Jews whose habitual language was Greek and who attended Greek-speaking synagogues; the Hebrews spoke Aramaic (or Mishnaic Hebrew) and attended synagogues where the service was conducted in Hebrew. Many of the Hellenists had affinities with the lands of the Jewish dispersion around the Mediterranean shores, whereas the Hebrews were Palestinian Jews; there were doubtless several minor social and cultural differences between the two groups. In the Jewish world as a whole there were tensions between them, and some of these tensions endured between members of the two groups who had joined the “disciples” (Bruce, 1988, p. 120).

The Hellenists are Jews of the Diaspora that have assimilated some aspects of Greek culture – especially language. Arnold G. Fruchtenbaum, in his commentary on Acts explains that their was a grievance growing among the Hellenists against the Hebrews:

[W]hile the church was deeply concerned about taking care of the widows, there seems to have been a prejudice in favor of the locally born, Hebrew speaking widows, over the Greek speaking widows who had immigrated into the country. The latter felt neglected and overlooked in the daily distribution (Fruchtenbaum, 2005, Kindle Locations 2723-2725).

Out of the growth caused by the ministry of the word (Acts 5:42) came diversity. Out of the diversity arose discrimination and inequity. In order to deal with inequity and discrimination there would need to be an intervention by the apostles. The handling of the matter by the twelve contains principles of missional living that are sorely needed by many fellowships and individuals today. If we are willing to listen to the voice of the early church apostles, our ministries, personal and corporate, can become more efficient and more effective. The twelve tell us to concentrate on our calling, delegate duties, and then watch God work.

Questions for Personal Study

  1. Are there indicators that your ministry is operating below its potential? This could be seen in missed opportunities due to obligations outside your calling or quality that is lower than what you are capable of?
  2. Has anyone shared with you criticism concerning your ministry that could be useful in looking for places to improve?
  3. Do you desire to raise the quality of your ministry and the quantity of people reached?

References

Bruce, F. F. (1988). The Book of the Acts. Grand Rapids, MI: Wm. B. Eerdmans Publishing Co.

Fruchtenbaum, Arnold G (2005). Commentary Series: The Book of Acts. Ariel Ministries.

Notes

The women seen in the featured image of this post were at a conference in Atlanta. Immediately to my right is Yvonne. Across the table is Virgina. I was there for the company owned by my wife and I, BIF Technologies, on business with Xtreme Solutions. After our respective work we met over prayer, the Scriptures, and worship in a public setting. We endeavored to (1) be above reproach and (2) make the most of the moment. Maximizing your ministry may be as simple as using moments that seem secular for purposes sanctified.

Calculating Sprint Velocity and Efficiency

Introduction

Are you using Agile to help your organization deliver products and/or services? If the answer to that question is yes, then you are breaking the work of bringing products and services to your customers into sprints. (If you are new to Agile and you do not know what a sprint is, I recommend Schwaber’s The Scrum Guide: The Definitive Guide to Scrum: The Rules of the Game.) A sprint in Agile is a time-boxed period.

Figure 1 – A Sprint is a Time-Boxed Period for Agile Work. The figure shows time boxing outside of Agile for time at work.

That period ranges from one to four weeks. During the sprint period a specific set of work is attempted and made ready for review by a customer. The sprint is a fundamental unit in Scrum and the Agile framework.

Your sprint is a single iteration in your product development or service delivery process. What happens during a sprint? It depends on whether your organization or team produces a product or a service. Let us say, for our discussion, that your team labors to deliver a viable version of a product. (A product could be  a piece of software, alternators for a particular line of trucks, or a newsletter for a non-profit ministry). Your sprint begins with a planning meeting where the team defines the sprint goal and selects items from the product backlog to work on in the time-boxed period.

Figure 2 – Sprint tasks are selected from the backlog for completion in the time-boxed period.

Your sprint ends with a review and retrospective to assess the work completed and improve processes for the next sprint.

Getting better at sprints should be the ongoing goal of any organization that is leveraging Agile. To improve at sprinting there has to be business intelligence that tells the team how they did on the sprint. There have to be metrics and visuals that provide insight on (1) how things went down, (2) what went well, and (3) what could be done better.

  • Burndown Chart — A burndown chart in Agile is a visual tool that assists a team in tracking the progress of a project. It showings the amount of work remaining over time. The chart typically has time on the horizontal axis and work remaining (often in story points or hours) on the vertical axis.

Figure 3 – Example Sprint Burndown Chart

  • Velocity — a tool that tracks the amount of work a team completes during a sprint. This metric usually is measured in story points or hours. It helps teams understand their progress, forecast future performance, and plan upcoming sprints more effectively by analyzing trends in completed work over time.
  • Goal Success Rate — refers to the percentage of goals (or objectives) that a team successfully meets or achieves within a sprint. It measures how effectively a team delivers on its planned commitments. This metric helps to assess the team’s performance and ability to meet its targets.

Let us take on just one of these business intelligence components — velocity. Calculating velocity in Agile is important for several reasons:

  • Predictability and Planning — Velocity calculations help teams estimate how much work they can complete in future sprints based on past performance. By knowing the average velocity, teams can make more accurate sprint plans, ensuring that they commit to a realistic amount of work. Velocity also helps with release planning. Using velocity a team is equipped to predict how many sprints are needed to complete a given set of features; this helps in release planning and setting realistic deadlines.
  • Tracking Performance — By tracking velocity over multiple sprints, teams can monitor their performance. A consistent velocity (cruising) or improving velocity (acceleration) indicates a stable or improving team dynamic. Likewise, a declining velocity (deceleration) may signal overcommitment, burnout, or other inefficiencies that need to be addressed. Watching velocity for fluctuations can help in identifying bottlenecks or other emerging issues. Vigilance in this area can help a team leader to be proactive in preventing problems that will sink a project or cause serious delays.
  • Transparency — Velocity provides an easy-to-understand metric that can be shared with stakeholders to communicate the team’s progress and capacity. This transparency builds trust and helps manage stakeholder expectations regarding timelines and deliverables. With good velocity data, stakeholders and teams can make informed decisions about scope adjustments, prioritization of work, or resource allocation to ensure that the project stays on track and aligned with business goals.

Using Jira to Calculate Velocity and Efficiency

Jira is a popular project management and issue tracking software packaged developed by Atlassian. It is widely used by Agile teams to manage their software development processes. Let us say that we have a software product called XSIPBI. Further, let us say that we are working through the development and release of features using sprints. In the table below we provide basic metrics for each sprint. The velocity in each sprint is the sum of story points for completed tasks.

Sprint Committed Completed / Velocity Goal Success Rate Start Date End Date Duration Days Efficiency ( pts / day )
XSIPBI Sprint 011 20.8 3.8 18% 2024-05-22 2024-06-04 10 0.380
XSIPBI Sprint 012 27.5 22.4 81% 2024-06-04 2024-06-27 18 1.244
XSIPBI Sprint 013 28.8 16.5 57% 2024-06-27 2024-07-16 14 1.179
XSIPBI Sprint 014 60.5 45.5 75% 2024-07-16 2024-08-05 15 3.033
XSIPBI Sprint 015 4.8 12.5 260% 2024-08-05 2024-08-13 7 1.786

The formula for velocity, for those who like the notation of the Mathematics, is very simple and given in the equation below:

In this equation V is velocity and taski is the story points for the task with index i. While velocity is often touted as important, I find efficiency more informative as a metric of team performance in a sprint. Efficiency tells us the rate at which story points were being completed for each day of the sprint. The efficiency of a team is a ratio that makes it easy to compare the rate at which work was done across sprints. The sprint with the highest velocity in Table 1 is Sprint 014. More important than its velocity is the fact that it has the highest efficiency; three story points were completed every day… on average. The efficiency of Sprint 014 is higher than the efficiency of any of the other sprints in the table. Give a day to Sprint 012 and it will only finish 1.24 story points. Give the same amount of time to Sprint 014 and it will get more than twice the story points completed.

I regard sprint Efficiency like the MPG of a car. With a 2024 Ford Bronco Sasquatch (2.7L, 6-cyl, AWD) I can go 17 miles on a gallon of gas in city driving; in other words, it has a city MPG of 17. With a 2024 Ford Maverick (2.5L, 4-cyl) I can go 33 miles on a gallon of gas in city driving; it has city MPG of 33. Given a single gallon of gas, the 2024 Ford Maverick is more efficient. Of course this is an oversimplification of how car efficiency is measured. We should also consider things like towing capacity and the number of cylinders in the engine. Likewise, when measuring the efficiency of a sprint we should also take into account the number of people involved and other resources required for getting the work done.

Conclusion

If you will add velocity to your business intelligence review of a sprint you will be able to use history to do better planning. A story point commitment that is being considered should be evaluated in the light of past commitments and how much was actually completed – the velocity. Don’t commit to story points that history shows are a case of sandbagging or pipe dreaming; make realistic goals using the velocity history of your team. Also, it would be good to calculate the efficiency of each sprint. This ratio gives you the mean of story points your team completed each day. I regard this value as the true velocity and can use it to say whether or not our team can expect to finish all of the tasks before the end of the sprint. Using efficiency I am equipped to decide which task should get the attention if we know that not all of them can get done.

Side Note on Time-Boxing

Time-boxing refers to the project management practice of allocating a fixed amount of time to an activity, task, or event. Once the set time limit, or “time box,” is reached, the activity or task is stopped. What if the task or activity is not complete? It is still stopped. When time boxing of work is used to manage work, the task, activity, or event, regardless of whether it is completed, is brought to a halt. This concept is an often-used time management technique to ensure that work progresses efficiently and that time is used effectively.

Is it practical? Very! In a practical sense, time-boxing keeps teams on track by forcing them to acknowledge the scarcity of time. Teams or individuals using time boxing focus on specific tasks within a predetermined timeframe, avoiding scope creep and helping to prioritize work. For example, in a Scrum meeting, a “time-boxed” daily stand-up might be limited to 15 minutes. After 15 minutes the meeting ends. The meeting ends regardless of whether all topics have been discussed. This approach encourages concise communication and efficient use of time.

References

Schwaber, K., & Sutherland, J. (2020). The Scrum Guide: The Definitive Guide to Scrum: The Rules of the Game. Scrum.org. Retrieved from https://www.scrumguides.org/scrum-guide.html

Pressman, R. S., & Maxim, B. R. (2014). Software Engineering: A Practitioner’s Approach (8th ed.). McGraw-Hill Education.

Rubin, K. S. (2012). Essential Scrum: A Practical Guide to the Most Popular Agile Process. Addison-Wesley.

 

On Our Terms! (Acts 5:17-18, 26)

The apostles keep getting arrested. First it was just Peter and John (Acts 4:1-3). Now it is all of them (Acts 5:17-18). That is, in our passage the high priest came with a group and arrested all of the apostles. Soon after they were released by an angel (Acts 5:19-20). Today, they are being arrested again. But it is different. Notice the contrast between the arrest of yesterday (Acts 5:17-18) and today (Acts 5:26).

  • Yesterday it was a “hands-on” approach to getting the apostles. The arrest literally involved a throwing on of hands (ἐπέβαλον τὰς χεῖρας ἐπὶ τοὺς ἀποστόλους) by the captain of the temple and his officers. To understand what is meant by “laid their hands on the apostles” it helps to see that the word being translated laid (ἐπέβαλον) is found in other places (Acts 4:3; 21:27). Anyone who becomes acquainted with the other passages where ἐπέβαλον is used, can see that the arrest of the apostles was violent.
  • Today, however, the captain went with the officers and brought the apostles without violence (Acts 5:26). The apostles have most certainly reported their imprisonment, angelic visitation, and command to “speak to the people all the words of this life” (Acts 5:20). With that in mind, the captain’s attempt to arrest the apostles must be seen as evil. It is really an attempt to prevent (1) a ministry that has been helping hurting people and (2) the bringing of the message of eternal life through faith in Jesus Christ. The jealousy (indignation) of the high priest was the motivation behind the arrest. In the power of the Holy Spirit the Galileans are drawing the people away from the Sadducees to the Savior.

But, what changed? That is, why is this second attempt to get the apostles without violence. The text makes it clear: the captain and the officers are afraid.

Then the captain went with the officers and brought them without violence, for they feared the people, lest they should be stoned. (Acts 5:26)

It is obvious that the people now side with the apostles and are willing to use their greater numbers and the stones in the immediate vicinity to stop the arrest. (We must also see that the foolishness of Sadducee teachings is now on full display. Sadducees do not believe in angels (Acts 23:8). However, according to the apostles, an angel let them out of prison. Either the prison is truly dysfunctional and the apostles are lying or there is growing evidence that angels are real.) The religious leaders want to shut down an effective ministry and the people are now standing in the way. If the apostles are going to be arrested, they are going to have to be willing to go on their terms.

They are unstoppable! No weapon formed against them will prosper (Isaiah 54:17).

In His grip by His grace,
Roderick L. Barnes, Sr.

Pulling a Thread

Introduction

Some web applications require a lot of attention. If there are a lot of concurrent users, complex SQL queries, and the frequent need to create large batches of records in ACID compliant transactions, efficient resource management is crucial. The web application that has characteristics like those just mentioned, if it is going to bring deliver responsive and reliable services to its user community, must be managed with high intention.  Among the things that must be managed are threads. (Self-managing web applications for large user bases is a nice idea. But at the time of this writing, my peers in the software development industry are not declaring victories in this area.) In Java-based web applications, threads play a pivotal role in handling concurrent requests, performing background tasks, and ensuring that the application remains responsive under high loads.

When thread management is either ignored or handled improperly, issues ensue. What kind of issues?

  • Thread / Memory Leaks — Thread leaks occur when threads are not properly terminated or returned to the thread pool. Does it matter? Yes! If the threads are not being properly terminated or returned to the thread pool, and they are being created as the application runs, threads are leaking out. This will lead to a depletion of available threads, causing the application to hang or crash. (Eventually there are no threads are left to handle incoming requests.) How does this happen? This could be due to spend thrifty creation of threads in our code. Each thread uses a chunk of memory. Excessive creation of threads without proper management will exhaust the JVM heap space and lead to OutOfMemoryError exceptions. (Practically speaking, not too long after you see these exceptions in log files, your application is going to crash or become unstable.)
  • Thread Starvation and Increased Latency — This happens when lower-priority threads are perpetually prevented from executing because higher-priority threads monopolize the CPU. These low prior threads are not altogether unimportant. But when they are forced to wait on resource hogging threads, their unimportant work eventually becomes urgent. Making them wait invariably leads to unresponsive services and missed deadlines for critical tasks. Users may see the symptoms in slow application response times.
  • Unexpected Behavior — Poorly managed threads can cause the application to behave unpredictably under different load conditions. This makes it difficult to ensure consistent performance and reliability, especially in a production environment. Inconsistent State: If a ThreadLocal variable is not properly initialized for each thread, different threads may see different states, leading to inconsistent behavior in the application. (I experienced this woe while working on an application written for a government agency. The mismanagement of ThreadLocal variables in Liferay kept manifesting itself in application users getting sessions that actually belonged to someone else. The menus of the application were determined by the security role associated with the user’s account. The security role was stored in the user’s session. Without warning a user would suddenly have the menu for another user with more or less privileges than themselves. No, I did not write that code. But I still had to fix it.) Inheritance Issues: Using InheritableThreadLocal can lead to unexpected behavior if child threads inadvertently inherit values from parent threads when such inheritance is not intended.

This post delves into the essentials of thread management in Java-based web applications that run on Apache Tomcat. In the discussion that follows we will give special attention to (1) enumerating threads, (2) checking for threads that require cleanup or termination, and (3) special issues associated with Threadlocal variables.

Enumerating the Threads in Your Web Application

Getting a list of all threads in a web application is very simple. I will show you two ways to do it. I will demonstrate getting the list of threads in a Java-based web application running in a standard servlet container. (This solution will run in Jetty, Apache Tomcat, Apache JBoss (WildFly), GlassFish, IBM WebSphere, or Oracle WebLogic.)

Step 1: Create a Thread-Enumerating Servlet

By creating the enumeration solution as a servlet you will make it easier to get the results. (Yes, you could write it to catalina.out. However, you may have to ask an administrator for the file. And the contents may contain a lot more than you need, want, or have permission to see.)

package org.roderickbarnes.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

@WebServlet("/enumerateThreads")
public class ThreadEnumerationServlet extends HttpServlet {
    
    @Override
    protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
        // Tell the calling client what type of content will be returned (This is the mime type).
        httpServletResponse.setContentType("text/plain");
        PrintWriter printWriter = httpServletResponse.getWriter();

        // Get all stack traces
        Map<Thread, StackTraceElement[]> mapOfThreadToStackTraces = Thread.getAllStackTraces();
        for (Map.Entry<Thread, StackTraceElement[]> mapEntry : mapOfThreadToStackTraces .entrySet()) {
            Thread thread = mapEntry.getKey();
            StackTraceElement[] arrayOfStackTraceElement = mapEntry.getValue();
            
            printWriter.println("Thread Name: " + thread.getName());
            printWriter.println("Thread ID: " + thread.getId());
            printWriter.println("Thread State: " + thread.getState());
            printWriter.println("Thread Priority: " + thread.getPriority());
            printWriter.println("Is Daemon: " + thread.isDaemon());
            
            printWriter.println("Stack Trace:");
            for (StackTraceElement stackTraceElement : arrayOfStackTraceElement) {
                out.println("\t" + stackTraceElement);
            }
            printWriter.println("--------------------------------------------------");
        }
        printWriter.close();
    }
}

Listing 1 – Servlet for listing threads in a web application.

The doGet method in the servlet fetches all live threads and their stack traces using Thread.getAllStackTraces(). It then prints the details of each thread to the servlet response. This step is an easy one. You can create your own glorious code. But move your thread management goals forward faster by copying the code above and pasting it into your IDE of choice.

Step 2: Registering and Deploying the Thread-Enumerating Servlet

Unless you are using annotations, update theweb.xmlof your web application or servlet container. An example is provided in Listing 2.

<servlet>
    <servlet-name>ThreadEnumerationServlet</servlet-name>
    <servlet-class>com.example.ThreadEnumerationServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>ThreadEnumerationServlet</servlet-name>
    <url-pattern>/enumerateThreads</url-pattern>
</servlet-mapping>

Listing 2 – Servlet deployment XML required for the web.xml file.

Deploy the web Application by doing the following:

  • Package your web application (WAR file) and deploy it to your servlet container server.
  • Ensure the servlet is correctly placed in the appropriate package (org.roderickbarnes.servlet in this case).

Step 3: Call the Servlet from Your Browser

Once deployed, you can access the servlet by navigating to http://your-server:port/your-app/enumerateThreads in your web browser. This will output the details of all active threads in your Tomcat application.

Pulling the Hanging Threads

Pulling Unstopped Threads

If you are creating threads manually, consider using ExecutorService from the java.util.concurrent package. This provides a better abstraction for managing threads, and you can easily shut down the executor service during application shutdown. Here are some of the benefits of using ExecutorService in your web application:

  • Thread Management – ExecutorService provides a clean and efficient way to manage a pool of threads, avoiding the overhead and risks associated with manually creating and managing threads. That is what this whole article is about. Using this service is a major move toward better thread management.
  • Graceful Shutdown – Proper handling of thread shutdown ensures that tasks are completed or terminated correctly, preventing resource leaks. ExecutorService facilitates graceful shutdown of your threads.
  • Concurrency Control – For those of us with a tendency toward micromanagement, the ExecutorService is a friend. You can control the number of concurrent tasks by configuring the thread pool size.

How would we use this service. Here below I provide you with the steps required to employ ExecutorService in the management of threads for your web application.

Step 1: Create a Thread Management Servlet that Uses ExecutorService

package org.roderickbarnes.servlet;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

@WebServlet("/executeTask")
public class TaskExecutorServlet extends HttpServlet {

    private ExecutorService executorService;

    private void setExecutorService(ExecutorService executorServiceNew) {
        this.executorService = executorServiceNew;
    }

    private ExecutorService getExecutorService() {
        return this.executorService;
    }

    @Override
    public void init() {
        // Initialize the ExecutorService with a fixed thread pool
        executorServiceNew = Executors.newFixedThreadPool(17);

        this.setExecutorService(executorServiceNew);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse httpServletResponse) throws IOException {
        // Submit a task to the executor service
        this.getExecutorService().submit(() -> {
            try {
                // Simulate a task
                System.out.println("Task executed by thread: " + Thread.currentThread().getName());
                TimeUnit.SECONDS.sleep(2); // Simulate work with a sleep
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                e.printStackTrace();
            }
        });

        httpServletResponse.getWriter().write("Task submitted");
    }

    @Override
    public void destroy() {
        // Shutdown the ExecutorService when the servlet is destroyed
        this.getExecutorService().shutdown();
        try {
            if (!this.getExecutorService().awaitTermination(60, TimeUnit.SECONDS)) {
                executorService.shutdownNow();
                if (!this.getExecutorService().awaitTermination(60, TimeUnit.SECONDS)) {
                    System.err.println("ExecutorService did not terminate");
                }
            }
        } catch (InterruptedException ie) {
            this.getExecutorService().shutdownNow();
            Thread.currentThread().interrupt();
        }
    }
}

Listing 3 – Demonstrating the use of ExecutorService to manage threads

Step 2: Add a ServletContextListener

To ensure proper cleanup and initialization, it’s a good idea to use a ServletContextListener that handles the lifecycle of the ExecutorService. Note: This is not required but is recommended.

 

package org.roderickbarnes.servlet;

@WebListener
public class ExecutorServiceListener implements ServletContextListener {

    private ExecutorService executorService;

    private void setExecutorService(ExecutorService executorServiceNew) { 
        this.executorService = executorServiceNew; 
    } 

    private ExecutorService getExecutorService() { 
        return this.executorService; 
    }
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        // Initialize the ExecutorService when the web application starts
        executorServiceNew = Executors.newFixedThreadPool(10);
        this.setExecutorService(executorServiceNew);
        sce.getServletContext().setAttribute("executorService", this.getExecutorService());
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        // Shutdown the ExecutorService when the web application stops
        ExecutorService executorServiceTemp = (ExecutorService) sce.getServletContext().getAttribute("executorService");
        if (executorServiceTemp != null) {
            executorServiceTemp.shutdown();
            try {
                if (!executorServiceTemp.awaitTermination(60, TimeUnit.SECONDS)) {
                    executorServiceTemp.shutdownNow();
                    if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
                        System.err.println("ExecutorService did not terminate");
                    }
                }
            } catch (InterruptedException ie) {
                executorServiceTemp.shutdownNow();
                Thread.currentThread().interrupt();
            }
        }
    }
}

Listing 4 – Demonstrating the use of ExecutorService to manage threads

Why is this a good practice? The ServletContextListener provides a centralized place (1) to initialize the ExecutorService when the web application starts and (2) to properly shut it down when the application stops. This ensures that the ExecutorService is consistently managed throughout the application’s lifecycle.

Step 3: Update your web.xml if you are not using annotations.

<web-app>
    <servlet>
        <servlet-name>TaskExecutorServlet</servlet-name>
        <servlet-class>org.roderickbarnes.TaskExecutorServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>TaskExecutorServlet</servlet-name>
        <url-pattern>/executeTask</url-pattern>
    </servlet-mapping>

    <listener>
        <listener-class>org.roderickbarnes.ExecutorServiceListener</listener-class>
    </listener>
</web-app>

Listing 5 – Demonstrating the use of ExecutorService to manage threads

But how does all this work. Here, let me explain. There are four parts worth noting.

The Servlet Initialization Part – When the servlet is initialized (init method), an ExecutorService is created with a fixed thread pool of 17 threads. This means that up to 17 tasks can be executed concurrently.

The Handling Requests Part – Each time a request is made to the servlet’s /executeTask endpoint, a new task is submitted to the ExecutorService. The task simulates some work by sleeping for 2 seconds. In your web application you would have something that needs to be c concurrent and is germane to the user community or application’s needs.

The Servlet Destruction Part – When the servlet is destroyed (e.g., when the application is undeployed or the server is shut down), the ExecutorService is properly shut down. This ensures that all threads are terminated gracefully, avoiding potential memory leaks. Did you get that part?

The Context Listener Part (Optional) – The ExecutorServiceListener manages the lifecycle of the ExecutorService at the application level, ensuring it is available throughout the application’s lifecycle and cleaned up properly when the application is stopped.

Pulling Threads Hanging Due to ThreadLocal Variables Not Being Cleaned Up

Wherever you use ThreadLocal variables, make sure to call ThreadLocal.remove() when the variable is no longer needed, especially in the cleanup code of your application (e.g., in ServletContextListener or a similar lifecycle hook).

ThreadLocal<MyObject> threadLocalOfMyObject = new ThreadLocal<MyObject>();

try {
    // Setup the ThreadLocal object.
    threadLocalOfMyObject.set(new MyObject());

    // Use the ThreadLocal object.
} finally {
    threadLocalOfMyObject .remove();
}

Listing 6 – Using a Try-Catch Block to Ensure Removal of ThreadLocal Variables

Conclusion

This article has introduced you to some ways you can remediate thread issues in your web application. The ideas suggested here are not panaceas by any means. They are a few of many means for getting threads under control and bringing high intentionality to the management of resources. Among the things that should be considered are using the ExecutorService and ensuring that ThreadLocal variables are properly cleaned up. Before getting started with any plan to change how threads are being handled, use a tool like the one provided in Listing 1 to get your thread inventory.

In His grip by His grace,
Roderick L. Barnes, Sr.

In the Aftermath of Chastening Part 2 (Acts 5:12-16)

Continuity of Miraculous Power (Acts 5:12a)

With the conjunction and of and through the apostles hands (δὲ τῶν χειρῶν τῶν ἀποστόλων) of Acts 5:12, the material following the tragedy of Ananias and Sapphira (Acts 5:1-11) is tied to the record of what follows (Acts 5:12-16). In effect, using the coordinating conjunction, Luke tells the reader to look at Acts 5:12-16 in light of what has just happened and to see it as a continuation of the Spirit’s work. Notice the continuity.

Do not miss the fact that the power of the apostle’s anointing continued to be at work with many signs and wonders being done among the people. Do not miss the significance of their continued ability to do miracles.

The same Spirit that was at work in the separation of the liars is still at work in the support of the leaders.

Their credentials as approved men of God and authorities to whom the people must listen were in the many signs and wonders (John 10:38; 14:11). If you were struggling with what had happened, your confidence in the apostles would be restored daily by their godly character and their great ongoing power and willingness to help others free of charge. Through the continuity of miracles through the apostles, Christ was telling the church that He continued to be at work both in and through the apostles and that He approved of the outcome with Ananias and Sapphira.

Continuity of Unified Fellowship (Acts 5:12b)

See their cohesion and oneness; the people continued to be unified as a fellowship. It says that they were all with one accord in Solomon’s Porch. In light of verse 13 the all is certainly a reference to the known congregation prior to the event of Acts 5:1-11. That same group of people, minus two, is still meeting in Solomon’s Portico or colonnade.

Figure 1: Solomon’s Porch Concept Art – Covered area with columns

Thousands of people have come to faith since Pentecost; the outpouring of the Spirit was in a room where a 120 people could meet. There are too many people to meet in the upper room mentioned in Acts 2. The apostles have taken up the practice of Jesus (John 10:23); they go to an open place in the temple to meet with the people in a ministry of teaching and miracles.

Unity remained and the custom of coming together in the temple to hear the word continued. When the Lord cleanses His community, the problem is removed, and the people continue in unity. If a church community disintegrates on account of disobedience, it may be an indicator that the Lord is removing the lampstand (Matthew 5:13-16; Revelation 2:5) of that fellowship. Unity is important and after a tragic event it must be guarded and promoted. Why is unity important?

Unity is an indispensable attribute of fellowships that will be effective as witnesses in their communities (Acts 1:8; John 13:35; 17:21) and in the work for which we were saved (Ephesians 2:10; 4:15-16 Galatians 6:2). The ongoing unity made the Jerusalem fellowship fit for witnessing to the world and the work of building up one another. Prince among preachers, Charles Spurgeon (June 19, 1834 – January 31, 1892), puts the importance of unity in perspective:

Satan always hates Christian fellowship; it is his policy to keep Christians apart. Anything which can divide saints from one another he delights in. He attaches far more importance to godly fellowship than we do. Since union is strength, he does his best to promote separation. (Spurgeon, 1868).

The events of Acts 5:1-11 (chastening or church discipline) and Acts 5:12-16 (continued power and unity) are a lesson for the modern church. We are prone to permit and tacitly promote evil when we do not take an active stand against it in our fellowships. Why? We are fearful that we will lose membership, lose financial stability, and lose our ability to reach the surrounding community. But the truth is that the compromise of not confronting and cutting out willful sinning will grieve the Spirit and hence undermine out witness. We cannot bear fruit if we do not abide in His word. Acts 5:1-16 is telling our churches to not believe the lie of losing the church if we deal with sin. The truth is that we will lose our churches if we don’t deal with willful disobedience.

Evaluate and Embrace or EliminatePeople and things that underscore the importance of unity and undertake the ongoing challenge to protect and promote Christ-centered unity in our churches are of the Spirit and missional in nature. People and things that persistently undermine church unity are demonic and are used by the devil in his dogged determination to destroy men and the mission given the local church. Take inventory church. Evaluate and embrace everything that is found to be in the first category. Eliminate with extreme prejudice everything that falls into the second and everyone that, when confronted, will not repent.

In this regard I am especially qualified to say something. My journey with Jesus has included highs in ministry and times of dealing with disobedience in ways that have been painful, public, and yet absolutely necessary for the health of the fellowship… and my own walk with God. Now I am thankful. In the handling of sin in our fellowships we cannot forget the importance of grace, gentleness, and the goal of restoration. Let nothing be done toward the sinning brother or sister that does not take into account God’s grace toward us in Christ (Ephesians 4:32); recipients of grace must not forget their own history of rebellion and the great grace that brought about their repentance. Gentleness, if possible, should be shown toward those who have failed. Only when the sinning persons demonstrates an unwillingness to repent should fellowship be shut off and interactions be limited to what is absolutely necessary. Finally, we should aim for restoration. That means, although a period of separation or being sidelined is in order, we want to see our brothers and sisters back in fellowship and using their gifts for the glory of God and the good of others. Peter failed. After a time he was restored. The brother in Corinth failed. He needed to be put out for a time. But not permanently. He needed to be restored. Restoration should become part of our stories; otherwise our churches become characterized by the false notion that the members have not messed up and that failure is unforgivable and the end of fellowship — an anti-gospel of sorts.

Questions for Consideration

  1. Is the fear of repercussions preventing your fellowship from confronting sin issues in the congregation?
  2. Does the church have a history of helping a fallen brother or sister get back up?
  3. What message does it send to the surrounding community if the person who fails is sent away permanently?

References

Spurgeon, Charles H. (1868). Lectures to My Students. Marshall, Morgan & Scott.

In the Aftermath of Chastening Part 1 (Acts 5:12-16)

In the Aftermath of Chastening (Acts 5:12-16)

12 And through the hands of the apostles many signs and wonders were done among the people. And they were all with one accord in Solomon’s Porch. 13 Yet none of the rest dared join them, but the people esteemed them highly. 14 And believers were increasingly added to the Lord, multitudes of both men and women, 15 so that they brought the sick out into the streets and laid them on beds and couches, that at least the shadow of Peter passing by might fall on some of them. 16 Also a multitude gathered from the surrounding cities to Jerusalem, bringing sick people and those who were tormented by unclean spirits, and they were all healed.

Introduction

What does a congregation do after events like the church discipline displayed with Ananias and Sapphira (Acts 5:1-11)? You could stop everything and get a consultant / counselor to come in and help everyone deal with the grief and fear that comes with (1) lying to the Spirit and (2) the Spirit’s abrupt removal of the liars. You could lose momentum and eventually have to shut things down. (In the denominations that I have served in such a response would involve contacting the district because the assets of the church actually belong to the denomination.) If you were in the Ananias camp you could convene a clandestine committee to replace Peter. (In light of most recent events, Peter is probably going to know. And may the Lord have mercy on you when you come to church.) Here is what the passage promotes:

1) Regard the church community and its individual members as sacred; do not bring into the bride of Christ worldly ways of getting ahead.

2) Acknowledge the anointing and authority of those appointed to lead. In the case of the apostles, their position and power in God’s work makes lying to them tantamount to lying to the Holy Spirit.

But what does a fellowship do after events like those recorded in Acts 5:1-11? In the writing of Luke we see that some things continue without change and one thing does not remain the same.

Questions for Consideration

  1. Do you interact with your local congregation as a sacred community or something common?
  2. While our local church leaders are not supernaturally able to discern the truth about things on their own, the Spirit can give them insights into things that would not otherwise be known. In your work with your leadership and other Christians are you mindful of the Spirit’s presence?